From fea181e87c019a20135623b0644b6b9585d6db13 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 1 Jul 2020 11:47:46 +0800 Subject: [PATCH] Test multiple index tags --- schema/index_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/schema/index_test.go b/schema/index_test.go index 384e902b..71a70a8c 100644 --- a/schema/index_test.go +++ b/schema/index_test.go @@ -16,7 +16,7 @@ type UserIndex struct { Name5 int64 `gorm:"index:,class:FULLTEXT,comment:hello \\, world,where:age > 10"` Name6 int64 `gorm:"index:profile,comment:hello \\, world,where:age > 10"` Age int64 `gorm:"index:profile,expression:ABS(age)"` - OID int64 `gorm:"index:idx_id"` + OID int64 `gorm:"index:idx_id;index:idx_oid,unique"` MemberNumber string `gorm:"index:idx_id"` } @@ -70,6 +70,11 @@ func TestParseIndex(t *testing.T) { Name: "idx_id", Fields: []schema.IndexOption{{}, {}}, }, + "idx_oid": { + Name: "idx_oid", + Class: "UNIQUE", + Fields: []schema.IndexOption{{}}, + }, } indices := user.ParseIndexes()