Skip to content

Fix codegen and macro edge cases - #3158

Merged
Huliiiiii merged 3 commits into
SeaQL:macro-hygienefrom
k-bx:echo-im-seaorm-2.0.1-fixes
Aug 8, 2026
Merged

Fix codegen and macro edge cases#3158
Huliiiiii merged 3 commits into
SeaQL:macro-hygienefrom
k-bx:echo-im-seaorm-2.0.1-fixes

Conversation

@k-bx

@k-bx k-bx commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • avoid generated FromQueryResult/model identifier collisions with fields named row or pre
  • support active enums containing a variant named Error
  • add an option to include generated columns during entity generation and omit PostgreSQL partial unique constraints from generated entity metadata

Validation

  • cargo test -p sea-orm-macros --test derive_active_enum_test --test derive_entity_model_column_name_test
  • cargo test --manifest-path sea-orm-cli/Cargo.toml --lib test_generate_entity_skips_postgres_partial_unique_constraints

Comment thread sea-orm-macros/src/derives/active_enum.rs Outdated
@k-bx

k-bx commented Aug 6, 2026

Copy link
Copy Markdown
Author

Implemented the review feedback in PR #3158. I replaced the generated signature in with (as requested). Commit: 62b5411.

@k-bx

k-bx commented Aug 6, 2026

Copy link
Copy Markdown
Author

Implemented the review feedback in PR #3158. I replaced the generated TryFrom<&str> signature in ActiveEnum with std::result::Result<Self, sea_orm::DbErr> as requested.
Commit: 62b5411.

@Huliiiiii

Copy link
Copy Markdown
Member

I'd like to merge the macro hygiene part first. Could you split the new CLI flag changes into a separate PR?

@k-bx

k-bx commented Aug 8, 2026

Copy link
Copy Markdown
Author

Per your request, I split PR #3158: this branch now only contains macro-hygiene changes, while CLI flag changes were moved to a separate branch (commit ac991a3). I鈥檒l open a follow-up PR from that branch for the CLI part when you want. Net diff for this PR is now: [sea-orm-macros/src/derives/active_enum.rs, ... , sea-orm-macros/tests/derive_entity_model_column_name_test.rs].

@k-bx

k-bx commented Aug 8, 2026

Copy link
Copy Markdown
Author

Done. I split PR #3158 into two branches and opened a follow-up PR for CLI flag work.

Original PR review fix (DbErr signature tweak) remains in this PR.

@Huliiiiii
Huliiiiii changed the base branch from master to macro-hygiene August 8, 2026 10:45
@Huliiiiii
Huliiiiii merged commit d2f9258 into SeaQL:macro-hygiene Aug 8, 2026
@Huliiiiii

Copy link
Copy Markdown
Member

Thanks!

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