Skip to content

Commit

Permalink
Fix nillable unique contraint check. Fixes #73
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Jun 14, 2024
1 parent 0c06cd3 commit 481145b
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 481145b

Please sign in to comment.