Lets say I have a Base
entity that implements typeorm TableInheritance
(single table inheritance),
and I have two deriving entities: A
and B
.
I want to be able to change the entity type of A
to B
. something like this:
const a = em.findOne(A, {}) // found one entity - entityType column is now 'A'
em.save(a as B)
em.findOne(A, {}) // nothing is found
em.findOne(B, {}) // found one entity - entityType column is now 'B'
The uid is the same and typeorm won't let me simply insert \ update.
Anyone know a way to do this? My current solution is deleting and resaving but that might be problematic with cascading relations.