Skip to content

Commit

Permalink
Mark primary key columns as unique in sea-orm-codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
SZenglein committed May 24, 2024
1 parent 2b6e724 commit d9e278c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sea-orm-codegen/src/entity/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl EntityTransformer {
col.unique = table_create
.get_indexes()
.iter()
.filter(|index| index.is_unique_key())
.filter(|index| index.is_unique_key() || index.is_primary_key())
.map(|index| index.get_index_spec().get_column_names())
.filter(|col_names| col_names.len() == 1 && col_names[0] == col.name)
.count()
Expand Down

0 comments on commit d9e278c

Please sign in to comment.