Skip to content

Commit

Permalink
Merge pull request #74 from openziti/fix-nillalbe-unique-idx-check
Browse files Browse the repository at this point in the history
Fix nillable unique contraint check. Fixes #73
  • Loading branch information
plorenz authored Jun 14, 2024
2 parents 0c06cd3 + 481145b commit 559e936
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion boltz/indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,14 @@ func (index *uniqueIndex) CheckIntegrity(ctx MutateContext, fix bool, errorSink

for entityCursor := index.symbol.GetStore().IterateValidIds(tx, ast.BoolNodeTrue); entityCursor.IsValid(); entityCursor.Next() {
id := entityCursor.Current()
_, fieldVal := index.symbol.Eval(tx, id)
fieldType, fieldVal := index.symbol.Eval(tx, id)
if fieldType == TypeNil {
if !index.nullable {
errorSink(errors.Errorf("entity with id %s has non-nillable unique index %v.%v, but field has nil value, unable to fix",
string(id), store.GetEntityType(), index.symbol.GetName()), false)
}
continue
}
idxId := index.Read(tx, fieldVal)

if idxId == nil {
Expand Down

0 comments on commit 559e936

Please sign in to comment.