diff --git a/localtests/discard-fk/create.sql b/localtests/discard-fk/create.sql index 557287c..6ef2d5c 100644 --- a/localtests/discard-fk/create.sql +++ b/localtests/discard-fk/create.sql @@ -1,3 +1,4 @@ +drop table if exists gh_ost_test_child; drop table if exists gh_ost_test; drop table if exists gh_ost_test_fk_parent; create table gh_ost_test_fk_parent ( diff --git a/localtests/fail-fk-parent/create.sql b/localtests/fail-fk-parent/create.sql new file mode 100644 index 0000000..ec713d6 --- /dev/null +++ b/localtests/fail-fk-parent/create.sql @@ -0,0 +1,41 @@ +drop table if exists gh_ost_test_child; +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + primary key(id) +) engine=innodb auto_increment=1; + +create table gh_ost_test_child ( + id int auto_increment, + i int not null, + parent_id int not null, + constraint test_fk foreign key (parent_id) references gh_ost_test (id) on delete no action, + primary key(id) +) engine=innodb; +insert into gh_ost_test (id) values (1),(2),(3); + +drop event if exists gh_ost_test; +drop event if exists gh_ost_test_cleanup; + +delimiter ;; +create event gh_ost_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into gh_ost_test_child values (null, 11, 1); + insert into gh_ost_test_child values (null, 13, 2); + insert into gh_ost_test_child values (null, 17, 3); +end ;; + +create event gh_ost_test_cleanup + on schedule at current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + drop table if exists gh_ost_test_child; +end ;; diff --git a/localtests/fail-fk-parent/expect_failure b/localtests/fail-fk-parent/expect_failure new file mode 100644 index 0000000..e69de29 diff --git a/localtests/fail-fk-parent/extra_args b/localtests/fail-fk-parent/extra_args new file mode 100644 index 0000000..2d00c49 --- /dev/null +++ b/localtests/fail-fk-parent/extra_args @@ -0,0 +1 @@ +--discard-foreign-keys diff --git a/localtests/fail-fk/create.sql b/localtests/fail-fk/create.sql new file mode 100644 index 0000000..6ef2d5c --- /dev/null +++ b/localtests/fail-fk/create.sql @@ -0,0 +1,32 @@ +drop table if exists gh_ost_test_child; +drop table if exists gh_ost_test; +drop table if exists gh_ost_test_fk_parent; +create table gh_ost_test_fk_parent ( + id int auto_increment, + ts timestamp, + primary key(id) +); +create table gh_ost_test ( + id int auto_increment, + i int not null, + parent_id int not null, + primary key(id), + constraint test_fk foreign key (parent_id) references gh_ost_test_fk_parent (id) on delete no action +) auto_increment=1; + +insert into gh_ost_test_fk_parent (id) values (1),(2),(3); + +drop event if exists gh_ost_test; +delimiter ;; +create event gh_ost_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into gh_ost_test values (null, 11, 1); + insert into gh_ost_test values (null, 13, 2); + insert into gh_ost_test values (null, 17, 3); +end ;; diff --git a/localtests/fail-fk/expect_failure b/localtests/fail-fk/expect_failure new file mode 100644 index 0000000..e69de29