typeorm-uml icon indicating copy to clipboard operation
typeorm-uml copied to clipboard

Child Entities cause duplication of columns on a table

Open hartjus opened this issue 3 years ago • 0 comments

If you utilize the @ChildEntity(someEnum.VALUE) feature of TypeORM on one or more entities, the diagram it creates for the table is incorrect. You will see the columns duplicated on the table in the diagram.

Parent class:

@Entity('table_name')
@TableInheritance({
  column: { type: 'enum', enum: SomeEnum, name: 'type' },
})
export abstract class TableEntity {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ type: 'text', nullable: true })
  name: string | null;
  ...

Child class:

@ChildEntity(SomeEnum.VALUE)
export class ChildEntity extends TableEntity {
...

hartjus avatar Aug 31 '22 22:08 hartjus