updated turnkey regression testing schema. added comments RE what role
[dbsrgits/SQL-Translator.git] / t / data / pgsql / turnkey.sql
CommitLineData
92c2965b 1-- 1 single FK import, data table
88f2d2fd 2create table a (
3 a_id serial not null,
4 primary key (a_id),
5 b_id int not null,
6 foreign key (b_id) references b (b_id),
7 name text
8);
9
92c2965b 10-- standalone, data table
65157eda 11create table b (
12 b_id serial not null,
13 primary key (b_id),
14 name text
15);
88f2d2fd 16
92c2965b 17-- 1 single FK import, link table between 'a' and 'b'
65157eda 18create table a_b (
19 a_b_id serial not null,
20 primary key (a_b_id),
21 a_id int not null,
22 foreign key (a_id) references a (a_id),
23 b_id int not null,
24 foreign key (b_id) references b (b_id)
25);
88f2d2fd 26
92c2965b 27-- 1 single FK import, data table
65157eda 28create table c (
29 c_id serial not null,
30 primary key (c_id),
31 b_id int not null,
32 foreign key (b_id) references b (b_id),
33 name text
34);
88f2d2fd 35
92c2965b 36-- 1 single FK import, data table
65157eda 37create table d (
38 d_id serial not null,
39 primary key (d_id),
40 c_id int not null,
41 foreign key (c_id) references c (c_id),
42 name text
43);
88f2d2fd 44
92c2965b 45-- standalone, data table
88f2d2fd 46create table e (
47 e_id serial not null,
48 primary key (e_id),
49 name text
50);
51
92c2965b 52-- 2 single FK import, link table between 'c' and 'e'
65157eda 53create table c_e (
54 c_e_id serial not null,
55 primary key (c_e_id),
56 c_id int not null,
57 foreign key (c_id) references c (c_id),
58 e_id int not null,
59 foreign key (e_id) references e (e_id)
60);
88f2d2fd 61
92c2965b 62-- 1 triple FK import, link table between 'e', 'e', and 'e'
65157eda 63create table f (
64 f_id serial not null,
65 primary key (f_id),
92c2965b 66 e1_id int not null,
67 foreign key (e1_id) references e (e_id),
68 e2_id int not null,
69 foreign key (e2_id) references e (e_id),
70 e3_id int not null,
71 foreign key (e3_id) references e (e_id)
65157eda 72);
88f2d2fd 73
92c2965b 74-- 1 single FK import, 1 double FK import, link table between 'a', 'e', and 'e'
88f2d2fd 75create table g (
76 g_id serial not null,
77 primary key (g_id),
78 a_id int not null,
79 foreign key (a_id) references a (a_id),
80 e1_id int not null,
81 foreign key (e1_id) references e (e_id),
82 e2_id int not null,
83 foreign key (e2_id) references e (e_id)
84);
85
92c2965b 86-- 1 double FK import, 1 triple FK import, link table between 'a', 'a', 'g', 'g', and 'g'
65157eda 87create table h (
88 h_id serial not null,
89 primary key (h_id),
90 a1_id int not null,
91 foreign key (a1_id) references a (a_id),
92 a2_id int not null,
93 foreign key (a2_id) references a (a_id),
94 g1_id int not null,
95 foreign key (g1_id) references g (g_id),
96 g2_id int not null,
97 foreign key (g2_id) references g (g_id),
98 g3_id int not null,
99 foreign key (g3_id) references g (g_id)
100);
101