~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
DROP TABLE IF EXISTS t1,t2,t3;
2
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
3
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id, id),
4
FOREIGN KEY (t1_id) REFERENCES t1(id)  ON DELETE CASCADE,
5
FOREIGN KEY (t1_id) REFERENCES t1(id)  ON UPDATE CASCADE) ENGINE=INNODB;
6
CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT, INDEX par_ind (t2_id),
7
FOREIGN KEY (id, t2_id) REFERENCES t2(t1_id, id)  ON DELETE CASCADE) ENGINE=INNODB;
1273.19.6 by Brian Aker
This remove the original info_schema system for the server. More still to
8
select * from data_dictionary.indexes where TABLE_SCHEMA= "test";
1309.4.4 by Brian Aker
Column changing.
9
TABLE_SCHEMA	TABLE_NAME	INDEX_NAME	IS_USED_IN_PRIMARY	IS_UNIQUE	IS_NULLABLE	KEY_LENGTH	INDEX_TYPE	INDEX_COMMENT
1732.3.1 by Monty Taylor
Subtract one - and then remove the extra binary character. This will keep
10
test	t1	PRIMARY	YES	YES	NO	4	UNKNOWN	NULL
11
test	t2	PRIMARY	YES	YES	NO	4	UNKNOWN	NULL
12
test	t2	par_ind	NO	NO	YES	8	UNKNOWN	NULL
13
test	t3	PRIMARY	YES	YES	NO	4	UNKNOWN	NULL
14
test	t3	id	NO	NO	YES	8	UNKNOWN	NULL
15
test	t3	par_ind	NO	NO	YES	4	UNKNOWN	NULL
1 by brian
clean slate
16
drop table t3, t2, t1;
17
CREATE TABLE t1(a1 INT NOT NULL, a2 INT NOT NULL,
18
PRIMARY KEY(a1, a2)) ENGINE=INNODB;
19
CREATE TABLE t2(b1 INT, b2 INT, INDEX (b1, b2),
20
CONSTRAINT A1
21
FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
22
ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
23
CREATE TABLE t3(b1 INT, b2 INT, INDEX t3_indx (b1, b2),
24
CONSTRAINT A2
25
FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
26
ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
27
CREATE TABLE t4(b1 INT, b2 INT, UNIQUE KEY t4_ukey (b1, b2),
28
CONSTRAINT A3
29
FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
30
ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
31
CREATE TABLE t5(b1 INT, b2 INT, INDEX (b1, b2),
32
CONSTRAINT A4
33
FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
34
ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
35
drop tables t5, t4, t3, t2, t1;
36
create database `db-1`;
37
use `db-1`;
38
create table `t-2` (
765 by Brian Aker
Fix information_schema_chmod test.
39
id int not null auto_increment,
1 by brian
clean slate
40
primary key (id)
41
) engine=innodb;
42
create table `t-1` (
765 by Brian Aker
Fix information_schema_chmod test.
43
id int not null auto_increment,
44
idtype int not null,
1 by brian
clean slate
45
primary key (id),
46
key fk_t1_1 (idtype),
47
constraint fk_t1_1 foreign key (idtype) references `t-2` (id)
48
) engine=innodb;
49
use test;
50
drop database `db-1`;
51
create table t1(id int primary key) engine = Innodb;
52
create table t2(pid int, foreign key (pid) references t1(id)) engine = Innodb;
53
set foreign_key_checks = 0;
54
drop table t1;
55
drop table t2;
56
set foreign_key_checks = 1;