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

DerivePrimaryKey with custom primary key column name #694

Merged
merged 2 commits into from
May 9, 2022

Conversation

billy1624
Copy link
Member

@billy1624 billy1624 commented May 3, 2022

PR Info

TODO

  • Allow primary key enum variant maps to custom column name

Adds

  • Allow overriding column name of primary key variant with macro attribute #[sea_orm(column_name = "db_id")]
  • DeriveEntityModel not only pass the column_name macro attribute to DeriveColumn but also DerivePrimaryKey

Fixes

  • The bug was originate from the fact that DerivePrimaryKey doesn't respect the column_name macro attribute supply to DeriveEntityModel

@billy1624 billy1624 self-assigned this May 3, 2022
@billy1624 billy1624 force-pushed the 693-primary-key-custom-col-name branch from d8a459e to 0c6c4da Compare May 3, 2022 08:51
@billy1624 billy1624 force-pushed the 693-primary-key-custom-col-name branch from 0c6c4da to a7a8587 Compare May 3, 2022 08:55
@billy1624 billy1624 marked this pull request as ready for review May 3, 2022 16:04
@billy1624 billy1624 requested a review from tyt2y3 May 3, 2022 16:04
Copy link
Member

@tyt2y3 tyt2y3 left a comment

Choose a reason for hiding this comment

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

Great work

@tyt2y3 tyt2y3 merged commit 5a123b3 into master May 9, 2022
@tyt2y3 tyt2y3 deleted the 693-primary-key-custom-col-name branch May 9, 2022 14:00
@billy1624 billy1624 linked an issue May 18, 2022 that may be closed by this pull request
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.

Failing find_with_related with column_name attribute Insert with Custom column Id doesn't work
2 participants