Open leogcba opened 1 year ago
When i try to register the second child entity, i get an error saying that there are duplicated columns. If I only register one child entity, i don't get this error.
QueryFailedError: Column "entityId" already exists
@Entity('agreements') @TableInheritance({ column: { name: 'entityType', type: 'text' } }) export default abstract class AbstractAgreement extends BaseEntity { @PrimaryColumn({ type: 'uuid' }) public id: string; @Column() public agreementType: string; } @ChildEntity('Account') export default class AccountAgreement extends AbstractAgreement { @Column({ name: 'entityId', type: 'uuid' }) public accountId: string; } @ChildEntity('Customer') export default class CustomerAgreement extends AbstractAgreement { @Column({ name: 'entityId', type: 'uuid' }) public customerId: string; } this.db.adapters.createTypeormDataSource({ entities: [ 'src/**/abstractAgreement.entity.ts', 'src/**/accountAgreement.entity.ts', 'src/**/customerAgreement.entity.ts', ], subscribers: ['src/**/*.subscriber.ts'], synchronize: true, type: 'postgres', }),
Failed SQL statement: CREATE TABLE "agreements" ("id" uuid NOT NULL, "agreementType" character varying NOT NULL, "entityId" uuid, "entityId" uuid, "entityType" text NOT NULL, CONSTRAINT "PK_01532f6c999d44c776e3d1fa4c8" PRIMARY KEY ("id"));
2.6.12
Describe the bug
When i try to register the second child entity, i get an error saying that there are duplicated columns. If I only register one child entity, i don't get this error.
To Reproduce
pg-mem version
2.6.12