@@ -65,7 +65,7 @@ func TestParseIndex(t *testing.T) {
6565		"idx_name" : {
6666			Name :   "idx_name" ,
6767			Class :  "UNIQUE" ,
68- 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "Name2" }}},
68+ 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "Name2" ,  Unique :  true }}},
6969		},
7070		"idx_user_indices_name3" : {
7171			Name :  "idx_user_indices_name3" ,
@@ -81,7 +81,7 @@ func TestParseIndex(t *testing.T) {
8181		"idx_user_indices_name4" : {
8282			Name :   "idx_user_indices_name4" ,
8383			Class :  "UNIQUE" ,
84- 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "Name4" }}},
84+ 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "Name4" ,  Unique :  true }}},
8585		},
8686		"idx_user_indices_name5" : {
8787			Name :    "idx_user_indices_name5" ,
@@ -102,12 +102,12 @@ func TestParseIndex(t *testing.T) {
102102		},
103103		"idx_id" : {
104104			Name :   "idx_id" ,
105- 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "MemberNumber" }}, {Field : & schema.Field {Name : "OID" }}},
105+ 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "MemberNumber" }}, {Field : & schema.Field {Name : "OID" ,  Unique :  true }}},
106106		},
107107		"idx_oid" : {
108108			Name :   "idx_oid" ,
109109			Class :  "UNIQUE" ,
110- 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "OID" }}},
110+ 			Fields : []schema.IndexOption {{Field : & schema.Field {Name : "OID" ,  Unique :  true }}},
111111		},
112112		"type" : {
113113			Name :   "type" ,
@@ -168,6 +168,9 @@ func TestParseIndex(t *testing.T) {
168168			if  rf .Field .Name  !=  ef .Field .Name  {
169169				t .Fatalf ("index field should equal, expects %v, got %v" , rf .Field .Name , ef .Field .Name )
170170			}
171+ 			if  rf .Field .Unique  !=  ef .Field .Unique  {
172+ 				t .Fatalf ("index field '%s' should equal, expects %v, got %v" , rf .Field .Name , rf .Field .Unique , ef .Field .Unique )
173+ 			}
171174
172175			for  _ , name  :=  range  []string {"Expression" , "Sort" , "Collate" , "Length" } {
173176				if  reflect .ValueOf (ef ).FieldByName (name ).Interface () !=  reflect .ValueOf (rf ).FieldByName (name ).Interface () {
0 commit comments