Skip to content

Fix entity codegen for PostgreSQL enum array columns#3121

Merged
Huliiiiii merged 1 commit into
SeaQL:masterfrom
enkhjile:fix/enum-array-column-codegen
Jul 7, 2026
Merged

Fix entity codegen for PostgreSQL enum array columns#3121
Huliiiiii merged 1 commit into
SeaQL:masterfrom
enkhjile:fix/enum-array-column-codegen

Conversation

@enkhjile

@enkhjile enkhjile commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #3120

PostgreSQL enum array columns (my_enum[]) were generated with a scalar active-enum type in the Model struct (e.g. SubscriptionStatus) instead of Vec<SubscriptionStatus>.

The regression was introduced in #2880: get_column_rs_types_with_enum_idents uses get_inner_col_type() to detect enums, which unwraps Array(Enum) to Enum.

This PR routes array columns through get_rs_type() (which already handles Vec<...> correctly) and keeps the enum-ident shortcut for scalar enum columns only.

Test plan

  • Added test_enum_array_column_generates_vec covering array + scalar enum columns in dense format
  • Verified the test fails without the fix
  • cargo test -p sea-orm-codegen passes (74 passed, 1 ignored)

Made with Cursor

Array enum columns were emitted as scalar active-enum types because
get_column_rs_types_with_enum_idents used get_inner_col_type(), which
unwraps Array(Enum) to Enum. Route array columns through get_rs_type()
instead.

Fixes SeaQL#3120

Co-authored-by: Cursor <cursoragent@cursor.com>
@Huliiiiii Huliiiiii merged commit 943bfb1 into SeaQL:master Jul 7, 2026
39 checks passed
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.

Entity codegen emits scalar enum type for PostgreSQL enum array columns

2 participants