From ba0bc25870e7f6a0ce4e8e61453218c8ff834ec8 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 25 May 2024 07:37:17 +0800 Subject: [PATCH] Refactor Xun.ColumnAlt function to handle index and unique removal --- schema/xun/xun.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/xun/xun.go b/schema/xun/xun.go index c0ee3fd8..20b6f4d9 100644 --- a/schema/xun/xun.go +++ b/schema/xun/xun.go @@ -229,12 +229,12 @@ func (x *Xun) ColumnAlt(name string, column types.Column) error { sch := x.Manager.Schema() // drop index - if column.RemoveIndex { + if column.RemoveIndex || column.Index { x.IndexDel(name, fmt.Sprintf("%s_index", column.Name)) } // drop unique - if column.RemoveUnique { + if column.RemoveUnique || column.Unique { x.IndexDel(name, fmt.Sprintf("%s_unique", column.Name)) }