more tests for foreign keys, including expected failures
This commit is contained in:
parent
a4d566e71c
commit
4d4af07295
@ -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;
|
||||||
drop table if exists gh_ost_test_fk_parent;
|
drop table if exists gh_ost_test_fk_parent;
|
||||||
create table gh_ost_test_fk_parent (
|
create table gh_ost_test_fk_parent (
|
||||||
|
41
localtests/fail-fk-parent/create.sql
Normal file
41
localtests/fail-fk-parent/create.sql
Normal file
@ -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 ;;
|
0
localtests/fail-fk-parent/expect_failure
Normal file
0
localtests/fail-fk-parent/expect_failure
Normal file
1
localtests/fail-fk-parent/extra_args
Normal file
1
localtests/fail-fk-parent/extra_args
Normal file
@ -0,0 +1 @@
|
|||||||
|
--discard-foreign-keys
|
32
localtests/fail-fk/create.sql
Normal file
32
localtests/fail-fk/create.sql
Normal file
@ -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 ;;
|
0
localtests/fail-fk/expect_failure
Normal file
0
localtests/fail-fk/expect_failure
Normal file
Loading…
Reference in New Issue
Block a user