Skip to content

Discriminator conflict reported even for non-inherited tables #2984

@amaranth

Description

@amaranth

Issue type:

[ ] question
[X] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[X] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[X] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

If you have two entity classes with the same name and one of them uses @TableInheritance TypeORM will check to see if other entities have the same discriminator and fail because the other class does. However, as this other class is just a plain entity the conflict shouldn't matter, they don't have any effect on each other.

entities/issue/note.ts:

@Entity({name: "issueNote"})
@TableInheritance({column: {type: "varchar", name: "type"}})
export class Note {

    @PrimaryGeneratedColumn()
    public id: number;

}

entities/commit/note.ts:

@Entity({name: "commitNote"})
export class Note {

    @PrimaryGeneratedColumn()
    public id: number;

}
Error: Entities Note and Note as equal discriminator values. Make sure their discriminator values are not equal using @DiscriminatorValue decorator.
    at EntityMetadataValidator.validate (/Users/travis/Projects/velocity/typeorm/src/metadata-builder/EntityMetadataValidator.ts:71:23)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions