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

This commit is contained in:
Googol Lee 2022-08-25 15:45:31 +02:00
parent 1400547b7e
commit 205d638974

View File

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