Skip to content

Commit

Permalink
ie: replicate pre-datamodel-renderer single-field unique behaviour
Browse files Browse the repository at this point in the history
The first unique index defined on the field wins. This became visible in
introspection CI after
#3333 was merged.

Arguably, we should instead introspect `@@unique()`s on the model for
extra single-field uniques, but that would be a change.
  • Loading branch information
tomhoule committed Nov 1, 2022
1 parent 7ce85a7 commit d6332de
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ impl<'a> Model<'a> {
let uniques: HashMap<&str, IndexFieldOptions> = dml_model
.indices
.iter()
.rev() // replicate existing behaviour on duplicate unique constraints
.filter(|ix| ix.is_unique())
.filter(|ix| ix.defined_on_field)
.map(|ix| {
Expand Down

0 comments on commit d6332de

Please sign in to comment.