You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
There are two entities A and B. A is independent from B and B has only an OneToOne relation to A. As such B is the owner of the relation and the foreign Key is also the primary key of this entity. It does not seem possible to remove B without removing the related A, but it should be.
To Reproduce
@Entity()exportclassA{
@PrimaryKey()id!: integer}
exportclassB{[PrimaryKeyType]: number
@OneToOne({primary: true})object!: CoreObjectEntity}
The removal of B (orm.em.removeAndFlush) always triggers the removal of A.
Expected behavior
The removal of B (orm.em.removeAndFlush) leaves A alone.
Additional context
I tried different properties (orphanRemoval, cascade) of OneToOne and also switched to ManyToOne to get the expected behavior but none worked.
Versions
Dependency
Version
node
14.13.1
typescript
4.0.3
mikro-orm
4.0.7
pg
8.4.1
The text was updated successfully, but these errors were encountered:
Describe the bug
There are two entities A and B. A is independent from B and B has only an OneToOne relation to A. As such B is the owner of the relation and the foreign Key is also the primary key of this entity. It does not seem possible to remove B without removing the related A, but it should be.
To Reproduce
The removal of B (orm.em.removeAndFlush) always triggers the removal of A.
Expected behavior
The removal of B (orm.em.removeAndFlush) leaves A alone.
Additional context
I tried different properties (orphanRemoval, cascade) of OneToOne and also switched to ManyToOne to get the expected behavior but none worked.
Versions
The text was updated successfully, but these errors were encountered: