Skip to content

Annotated foreign key constraint names not unique #38

Open
@TravisCardwell

Description

@TravisCardwell

When annotating foreign key constraints using foreignKeyOnPk or foreignKeyOn, constraint names are automatically created based on the table and columns of the referenced unique constraint. The name is not necessarily unique because many tables may have foreign key constraints that reference the same unique constraint. The constraint name clashes prevent beam-automigrate from being able to model non-trivial databases.

For example, both OrderT and LineItemT have foreign keys to FlowerT. The OrderT foreign key is annotated with a foreign key constraint. If a foreign key constraint was added for the LineItemT foreign key, the constraint names would clash.

Constraint names should instead be based on the table and columns of the foreign key constraint. This is a breaking change; it changes the names of constraints. I will submit a pull request with the fix.


tc-develop Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions