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

Add automatic naming conventions for database relations #138

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

uittenbroekrobbert
Copy link
Contributor

Description

This change enforces using default naming conventions when creating relationships with alembic.

By default, sqlalchemy does not enforce any naming rules on relations in the database, like foreign keys. This means when not specified, database defaults are used. This can cause problems when DDL/DML changes are done through alembic, and we don't know what name a relationship has.

To keep uniform names, older named relationships are also renamed in migration scripts. This means databases have to be fully recreated.

Resolves #125

Checklist

Please check all the boxes that apply to this pull request using "x":

  • I have tested the changes locally and verified that they work as expected.
  • I have followed the project's coding conventions and style guidelines.
  • I have rebased my branch onto the latest commit of the main branch.
  • I have squashed or reorganized my commits into logical units.
  • I have read, understood and agree to the Developer Certificate of Origin, which this project utilizes.

@uittenbroekrobbert uittenbroekrobbert requested a review from a team as a code owner August 13, 2024 10:31
@uittenbroekrobbert uittenbroekrobbert linked an issue Aug 13, 2024 that may be closed by this pull request
Copy link
Member

@berrydenhartog berrydenhartog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

sonarcloud bot commented Aug 13, 2024

@uittenbroekrobbert uittenbroekrobbert merged commit 3c58081 into main Aug 13, 2024
15 checks passed
@uittenbroekrobbert uittenbroekrobbert deleted the 125-sqlachemy-naming-conventions branch August 13, 2024 12:43
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 this pull request may close these issues.

Implement sqlachemy naming conventions
2 participants