Your Question
I have the following model:
type Test struct {
ID int64 `gorm:"primaryKey"`
Name string `gorm:"uniqueIndex"`
}
Now, if I want to make Name not unique anymore, the AutoMigrate func does not automatically remove the constraint. This is documented and fine.
My question is, how would I manually drop the unique constraint on the column, but keep the index?
The document you expected this should be explained
https://gorm.io/docs/migration.html
Expected answer
Code that drops the unique constraint
Comment From: a631807682
Currently only supports using DropIndex first and then CreateIndex.
DB.Migrator().DropIndex(&Test{},"idx_name")
DB.Migrator().CreateIndex(&Test{},"idx_name")