Skip to content

Commit

Permalink
distinguish FK names
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach committed Oct 25, 2023
1 parent e1653f9 commit bc700ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/test/endtoend/onlineddl/revert/onlineddl_revert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ func testRevertible(t *testing.T) {
},
{
name: "removed foreign key",
fromSchema: "id int primary key, i int, constraint some_fk foreign key (i) references parent (id) on delete cascade",
fromSchema: "id int primary key, i int, constraint some_fk_1 foreign key (i) references parent (id) on delete cascade",
toSchema: "id int primary key, i int",
removedForeignKeyNames: "some_fk",
removedForeignKeyNames: "some_fk_1",
},

{
Expand Down Expand Up @@ -419,7 +419,7 @@ func testRevertible(t *testing.T) {
checkTable(t, tableName, false)
})
t.Run("create child table", func(t *testing.T) {
fromStatement := fmt.Sprintf(createTableWrapper, "id int primary key, i int, constraint some_fk foreign key (i) references parent (id) on delete cascade")
fromStatement := fmt.Sprintf(createTableWrapper, "id int primary key, i int, constraint some_fk_2 foreign key (i) references parent (id) on delete cascade")
uuid := testOnlineDDLStatement(t, fromStatement, ddlStrategy, "vtgate", tableName, "")
onlineddl.CheckMigrationStatus(t, &vtParams, shards, uuid, schema.OnlineDDLStatusComplete)
checkTable(t, tableName, true)
Expand All @@ -440,7 +440,7 @@ func testRevertible(t *testing.T) {
droppedNoDefaultColumnNames := row.AsString("dropped_no_default_column_names", "")
expandedColumnNames := row.AsString("expanded_column_names", "")

assert.Equal(t, "some_fk", removeBackticks(removedForeignKeyNames))
assert.Equal(t, "some_fk_2", removeBackticks(removedForeignKeyNames))
assert.Equal(t, "", removeBackticks(removedUniqueKeyNames))
assert.Equal(t, "", removeBackticks(droppedNoDefaultColumnNames))
assert.Equal(t, "", removeBackticks(expandedColumnNames))
Expand Down

0 comments on commit bc700ca

Please sign in to comment.