From daf17c11a6bbed2df16773186c500f0c9bbdcbf7 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sat, 14 Sep 2024 20:46:48 +0800 Subject: [PATCH] Revert "fix: create index failed without err (#282)" (#284) This reverts commit f300cc471f123b6d84a4bc4738cffe89b5c1bb3f. --- migrator.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/migrator.go b/migrator.go index d2dbd4b..df18db1 100644 --- a/migrator.go +++ b/migrator.go @@ -146,14 +146,7 @@ func (m Migrator) CreateIndex(value interface{}, name string) error { createIndexSQL += " WHERE " + idx.Where } - 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) - } + return m.DB.Exec(createIndexSQL, values...).Error } }