Commit | Line | Data |
88f2d2fd |
1 | create table a ( |
2 | a_id serial not null, |
3 | primary key (a_id), |
4 | b_id int not null, |
5 | foreign key (b_id) references b (b_id), |
6 | name text |
7 | ); |
8 | |
65157eda |
9 | create table b ( |
10 | b_id serial not null, |
11 | primary key (b_id), |
12 | name text |
13 | ); |
88f2d2fd |
14 | |
65157eda |
15 | create table a_b ( |
16 | a_b_id serial not null, |
17 | primary key (a_b_id), |
18 | a_id int not null, |
19 | foreign key (a_id) references a (a_id), |
20 | b_id int not null, |
21 | foreign key (b_id) references b (b_id) |
22 | ); |
88f2d2fd |
23 | |
65157eda |
24 | create table c ( |
25 | c_id serial not null, |
26 | primary key (c_id), |
27 | b_id int not null, |
28 | foreign key (b_id) references b (b_id), |
29 | name text |
30 | ); |
88f2d2fd |
31 | |
65157eda |
32 | create table d ( |
33 | d_id serial not null, |
34 | primary key (d_id), |
35 | c_id int not null, |
36 | foreign key (c_id) references c (c_id), |
37 | name text |
38 | ); |
88f2d2fd |
39 | |
40 | create table e ( |
41 | e_id serial not null, |
42 | primary key (e_id), |
43 | name text |
44 | ); |
45 | |
65157eda |
46 | create table c_e ( |
47 | c_e_id serial not null, |
48 | primary key (c_e_id), |
49 | c_id int not null, |
50 | foreign key (c_id) references c (c_id), |
51 | e_id int not null, |
52 | foreign key (e_id) references e (e_id) |
53 | ); |
88f2d2fd |
54 | |
65157eda |
55 | create table f ( |
56 | f_id serial not null, |
57 | primary key (f_id), |
58 | el_id int not null, |
59 | foreign key (el_id) references e (e_id), |
60 | em_id int not null, |
61 | foreign key (em_id) references e (e_id), |
62 | en_id int not null, |
63 | foreign key (en_id) references e (e_id) |
64 | ); |
88f2d2fd |
65 | |
66 | create table g ( |
67 | g_id serial not null, |
68 | primary key (g_id), |
69 | a_id int not null, |
70 | foreign key (a_id) references a (a_id), |
71 | e1_id int not null, |
72 | foreign key (e1_id) references e (e_id), |
73 | e2_id int not null, |
74 | foreign key (e2_id) references e (e_id) |
75 | ); |
76 | |
65157eda |
77 | create table h ( |
78 | h_id serial not null, |
79 | primary key (h_id), |
80 | a1_id int not null, |
81 | foreign key (a1_id) references a (a_id), |
82 | a2_id int not null, |
83 | foreign key (a2_id) references a (a_id), |
84 | g1_id int not null, |
85 | foreign key (g1_id) references g (g_id), |
86 | g2_id int not null, |
87 | foreign key (g2_id) references g (g_id), |
88 | g3_id int not null, |
89 | foreign key (g3_id) references g (g_id) |
90 | ); |
91 | |