AutoMigrate() should always migrate checks, even there is no relationship constraints. (#5644)

* fix: remove uuid autoincrement

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

Co-authored-by: a631807682 <631807682@qq.com>
This commit is contained in:
Googol Lee 2022-09-14 04:26:51 +02:00 committed by GitHub
parent f29afdd329
commit edb00c10ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -135,6 +135,7 @@ func (m Migrator) AutoMigrate(values ...interface{}) error {
} }
} }
} }
}
for _, chk := range stmt.Schema.ParseCheckConstraints() { for _, chk := range stmt.Schema.ParseCheckConstraints() {
if !tx.Migrator().HasConstraint(value, chk.Name) { if !tx.Migrator().HasConstraint(value, chk.Name) {
@ -143,7 +144,6 @@ func (m Migrator) AutoMigrate(values ...interface{}) error {
} }
} }
} }
}
for _, idx := range stmt.Schema.ParseIndexes() { for _, idx := range stmt.Schema.ParseIndexes() {
if !tx.Migrator().HasIndex(value, idx.Name) { if !tx.Migrator().HasIndex(value, idx.Name) {