Debian Codegraph @

mysql-test/suite/ndb/t/ndb_fk_mysqldump.test

raw
1 -- source include/have_ndb.inc
2
3
4 create table product (
5 category int not null,
6 id int not null,
7 price decimal,
8 primary key(category, id))
9 engine=ndb;
10
11 create table customer (
12 id int not null,
13 primary key (id))
14 engine=ndb;
15
16 create table product_order (
17 no int not null auto_increment,
18 product_category int not null,
19 product_id int not null,
20 customer_id int not null,
21 primary key(no),
22 index (product_category, product_id),
23 constraint fk1
24 foreign key (product_category, product_id) references product(category, id)
25 on update restrict on delete cascade,
26 index (customer_id),
27 constraint fk2
28 foreign key (customer_id) references customer(id))
29 engine=ndb;
30
31 --disable_warnings
32 show create table product;
33 show create table customer;
34 show create table product_order;
35 --enable_warnings
36
37 insert into product values (1,1,5);
38 insert into customer value (1);
39 insert into product_order value (1,1,1,1);
40
41 let $dump_file = $MYSQLTEST_VARDIR/tmp/ndb_fk_dump.sql;
42 --exec $MYSQL_DUMP --databases test > $dump_file
43
44 # bug#16286164: the fix exposes DROP order problem
45 if (1)
46 {
47 drop table product_order, customer, product;
48 }
49
50 --exec $MYSQL test < $dump_file
51
52 --disable_warnings
53 show create table product;
54 show create table customer;
55 show create table product_order;
56 --enable_warnings
57
58 drop table product_order, customer, product;
59 --remove_file $dump_file