Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
BaccanoMob opened this issue Jan 6, 2025 · 1 comment · Fixed by #337
Closed

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

BaccanoMob opened this issue Jan 6, 2025 · 1 comment · Fixed by #337
Assignees

Comments

@BaccanoMob
Copy link

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

@shef-er
Copy link

shef-er commented Jan 17, 2025

Very important feature, need it too. At least good to have ability to manually set constraint names, else it makes barely whole app unusable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants