From fb39081c96ac9536420b8b98fa48685f69a834dd Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:46:55 +0200 Subject: [PATCH] Adding endtoend test for modifying FK child column from NULL-able to NOT NULL Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- .../vrepl_suite/onlineddl_vrepl_suite_test.go | 2 +- .../testdata/fk-child-modify-not-null/alter | 1 + .../fk-child-modify-not-null/create.sql | 17 +++++++++++++++++ .../fk-child-modify-not-null/ddl_strategy | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/alter create mode 100644 go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/create.sql create mode 100644 go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/ddl_strategy diff --git a/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go b/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go index 56818069e05..53e0512d5d8 100644 --- a/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go +++ b/go/test/endtoend/onlineddl/vrepl_suite/onlineddl_vrepl_suite_test.go @@ -59,7 +59,7 @@ var ( ) const ( - testDataPath = "testdata" + testDataPath = "tmptestdata" ) func TestMain(m *testing.M) { diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/alter b/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/alter new file mode 100644 index 00000000000..0660453e839 --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/alter @@ -0,0 +1 @@ +modify parent_id int not null diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/create.sql b/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/create.sql new file mode 100644 index 00000000000..a94abfdf6de --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/create.sql @@ -0,0 +1,17 @@ +set session foreign_key_checks=0; +drop table if exists onlineddl_test_child; +drop table if exists onlineddl_test; +drop table if exists onlineddl_test_parent; +set session foreign_key_checks=1; +create table onlineddl_test_parent ( + id int auto_increment, + ts timestamp, + primary key(id) +); +create table onlineddl_test ( + id int auto_increment, + i int not null, + parent_id int null, + primary key(id), + constraint test_fk foreign key (parent_id) references onlineddl_test_parent (id) on delete no action +) auto_increment=1; diff --git a/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/ddl_strategy b/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/ddl_strategy new file mode 100644 index 00000000000..f48a3989618 --- /dev/null +++ b/go/test/endtoend/onlineddl/vrepl_suite/testdata/fk-child-modify-not-null/ddl_strategy @@ -0,0 +1 @@ +--unsafe-allow-foreign-keys \ No newline at end of file