Skip to content

[FEATURE] Foreign Key Contraints (and others) Naming convention #331

Closed
@BaccanoMob

Description

@BaccanoMob

Currently, the name is {primary_key_table}{column_name}_fk, which is not ideal when you use that some primary key for multiple foreign keys.

With reference to Alembic docs, for foreign key constraint format may be as below,

"fk" - fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s

For example, Hero Table with id referenced by Team table will be like fk_hero_id_team

Other constraints if needed
"ix" - ix_%(column_0_label)s
"uq" - uq_%(table_name)s_%(column_0_name)s
"ck" - ck_%(table_name)s_%(constraint_name)s
"pk" - pk_%(table_name)s

Metadata

Metadata

Assignees

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