forked from mirror/gorm
Don't create index if there are error exist, close #3976
This commit is contained in:
parent
35ebfe6874
commit
f8bd4c4875
|
@ -183,7 +183,9 @@ func (m Migrator) CreateTable(values ...interface{}) error {
|
|||
for _, idx := range stmt.Schema.ParseIndexes() {
|
||||
if m.CreateIndexAfterCreateTable {
|
||||
defer func(value interface{}, name string) {
|
||||
errr = tx.Migrator().CreateIndex(value, name)
|
||||
if errr == nil {
|
||||
errr = tx.Migrator().CreateIndex(value, name)
|
||||
}
|
||||
}(value, idx.Name)
|
||||
} else {
|
||||
if idx.Class != "" {
|
||||
|
|
Loading…
Reference in New Issue