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

Improve the PostgreSQL scripts #35

Merged
merged 1 commit into from
Jan 27, 2024
Merged

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Jan 26, 2024

@0xced
Copy link
Contributor Author

0xced commented Jan 26, 2024

Haha, I should have looked at the open pull requests first, both #2 and #3 are also related to improving the PostgreSQL scripts. 😄

* Use PostgreSQL naming conventions
  * snake_case for table and coumn names, see [PostgreSQL naming conventions][1]
  * pkey/fkey/idx suffix for constraint names, see [PostgreSQL: default constraint names][2]
* Add a script with auto incremented PKs

[1]: https://stackoverflow.com/questions/2878248/postgresql-naming-conventions/2878408#2878408
[2]: https://stackoverflow.com/questions/4107915/postgresql-default-constraint-names/4108266#4108266
Copy link
Owner

@lerocha lerocha left a comment

Choose a reason for hiding this comment

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

Thank you so much for your contribution!

public virtual string FormatForeignKey(string table, string column) => FormatName($"FK_{table}{column}");

public virtual string FormatForeignKeyIndex(string table, string column) => FormatName($"IFK_{table}{column}");

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks! Great idea creating these methods in the strategy class.

@lerocha lerocha merged commit 6c71228 into lerocha:master Jan 27, 2024
@0xced 0xced deleted the improve-postgres branch January 27, 2024 13:41
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.

2 participants