Skip to content

Feature: Throw an error if model class has multiple foreign keys referencing the same model #401

Open
@RobinBuschmann

Description

@RobinBuschmann

sequelize-typescript should throw an error if it finds multiple foreign keys referencing the same model like:

@Table
export class FriendList extends Model<FriendList> {

  @ForeignKey(() => User)
  @Column
  UserId: number;

  @ForeignKey(() => User)
  @Column
  FriendId: number;
}

This should be because it cannot infer which is the actual foreignKey and which one is the otherKey.

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