Skip to content

Commit

Permalink
fix: create index failed without err
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhiqiangcs committed Aug 25, 2024
1 parent ff0ad0c commit 04bd0f7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,14 @@ func (m Migrator) CreateIndex(value interface{}, name string) error {
createIndexSQL += " WHERE " + idx.Where
}

return m.DB.Exec(createIndexSQL, values...).Error
err := m.DB.Exec(createIndexSQL, values...).Error
if err != nil {
return err
}

if !m.HasIndex(value, name) {
return fmt.Errorf("failed to create index with name %v", name)
}
}
}

Expand Down

0 comments on commit 04bd0f7

Please sign in to comment.