Skip to content

Commit

Permalink
adding more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
  • Loading branch information
shlomi-noach committed Jun 9, 2024
1 parent f3a4a97 commit 0da285a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions go/vt/schemadiff/schema_diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,40 @@ func TestSchemaDiff(t *testing.T) {
conflictingDiffs: 2,
instantCapability: InstantDDLCapabilityImpossible,
},
{
name: "add and drop FK, add and drop column, impossible order even with create table first strategy",
fromQueries: []string{
"create table t1 (id int primary key, p int, key p_idx (p));",
"create table t2 (id int primary key, p int, key p_idx (p), foreign key (p) references t1 (p) on delete no action);",
},
toQueries: []string{
"create table t1 (id int primary key, q int, key q_idx (q));",
"create table t2 (id int primary key, q int, key q_idx (q), foreign key (q) references t1 (q) on delete no action);",
},
expectDiffs: 2,
expectDeps: 1,
sequential: true,
conflictingDiffs: 2,
instantCapability: InstantDDLCapabilityImpossible,
fkStrategy: ForeignKeyCheckStrategyCreateTableFirst,
},
{
name: "add and drop FK, add and drop column, impossible order even with ignore strategy",
fromQueries: []string{
"create table t1 (id int primary key, p int, key p_idx (p));",
"create table t2 (id int primary key, p int, key p_idx (p), foreign key (p) references t1 (p) on delete no action);",
},
toQueries: []string{
"create table t1 (id int primary key, q int, key q_idx (q));",
"create table t2 (id int primary key, q int, key q_idx (q), foreign key (q) references t1 (q) on delete no action);",
},
expectDiffs: 2,
expectDeps: 1,
sequential: true,
conflictingDiffs: 2,
instantCapability: InstantDDLCapabilityImpossible,
fkStrategy: ForeignKeyCheckStrategyIgnore,
},
{
name: "add and drop FK, add and drop respective tables, fk strict",
fromQueries: []string{
Expand Down

0 comments on commit 0da285a

Please sign in to comment.