Skip to content

Commit

Permalink
AutoMigrate() should always migrate checks, even there is no relation…
Browse files Browse the repository at this point in the history
…ship constraints. (#5644)

* fix: remove uuid autoincrement

* AutoMigrate() should always migrate checks, even there is no relationship constranits.

Co-authored-by: a631807682 <631807682@qq.com>
  • Loading branch information
googollee and a631807682 committed Sep 14, 2022
1 parent f29afdd commit edb00c1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions migrator/migrator.go
Expand Up @@ -135,12 +135,12 @@ func (m Migrator) AutoMigrate(values ...interface{}) error {
}
}
}
}

for _, chk := range stmt.Schema.ParseCheckConstraints() {
if !tx.Migrator().HasConstraint(value, chk.Name) {
if err := tx.Migrator().CreateConstraint(value, chk.Name); err != nil {
return err
}
for _, chk := range stmt.Schema.ParseCheckConstraints() {
if !tx.Migrator().HasConstraint(value, chk.Name) {
if err := tx.Migrator().CreateConstraint(value, chk.Name); err != nil {
return err
}
}
}
Expand Down

0 comments on commit edb00c1

Please sign in to comment.