fix diff round-trip comparison
This commit is contained in:
@@ -301,6 +301,22 @@ func TestCompareIndexes(t *testing.T) {
|
||||
return len(d.Modified) == 1 && d.Modified[0].Name == "idx_name"
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "equivalent indexes with different generated names",
|
||||
source: map[string]*models.Index{
|
||||
"uidx_posts_user_id_title": {
|
||||
Name: "uidx_posts_user_id_title", Columns: []string{"user_id", "title"}, Unique: true,
|
||||
},
|
||||
},
|
||||
target: map[string]*models.Index{
|
||||
"posts_user_id_title_idx": {
|
||||
Name: "posts_user_id_title_idx", Columns: []string{"user_id", "title"}, Unique: true, Type: "btree",
|
||||
},
|
||||
},
|
||||
want: func(d *IndexDiff) bool {
|
||||
return len(d.Missing) == 0 && len(d.Extra) == 0 && len(d.Modified) == 0
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user