Skip to content

Comments

Improve the PostgreSQL scripts#35

Merged
lerocha merged 1 commit intolerocha:masterfrom
0xced:improve-postgres
Jan 27, 2024
Merged

Improve the PostgreSQL scripts#35
lerocha merged 1 commit intolerocha:masterfrom
0xced:improve-postgres

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