1 |
drop table a_b; |
2 |
drop table a; |
3 |
drop table b; |
4 |
drop table c; |
5 |
|
6 |
-- simple table |
7 |
create table a ( |
8 |
id serial, |
9 |
foo text |
10 |
); |
11 |
|
12 |
-- needed for referential integrity later on... |
13 |
create unique index i_a_id on a(id); |
14 |
|
15 |
-- another simple table |
16 |
create table b ( |
17 |
id serial, |
18 |
bar int |
19 |
); |
20 |
|
21 |
create unique index i_b_id on b(id); |
22 |
|
23 |
-- associative table to test replication with only one (wrongly) defined |
24 |
-- key (a_id) |
25 |
create table a_b ( |
26 |
a_id int not null references a(id), |
27 |
b_id int not null references b(id), |
28 |
stamp timestamp default now(), |
29 |
primary key(a_id,b_id) |
30 |
); |
31 |
|
32 |
-- test replication with completly wrong key (foo) |
33 |
create table c ( |
34 |
id int not null, |
35 |
foo text, |
36 |
bar text, |
37 |
primary key(id) |
38 |
); |
39 |
|
40 |
-- another associative table |
41 |
create table a_b_c ( |
42 |
a_id int not null references a(id), |
43 |
b_id int not null references b(id), |
44 |
c_id int not null references c(id), |
45 |
primary key(a_id,b_id,c_id) |
46 |
); |
47 |
|