| author | Tomas Zeman <tzeman@volny.cz> |
| Thu, 24 May 2012 11:19:26 +0200 | |
| changeset 99 | 49eb72a46208 |
| parent 98 | eac38214183d |
| child 100 | 1fcbeae1f9da |
| permissions | -rw-r--r-- |
|
98
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
1 |
-- DATABASE SCHEMA CHANGES BETWEEN 0.2 -> 0.3 VERSION |
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
2 |
|
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
3 |
-- project_location |
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
4 |
create table "project_location" ( |
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
5 |
"location" bigint not null, |
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
6 |
"project" bigint not null |
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
7 |
); |
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
8 |
alter table "project_location" add foreign key ("project") references "project"("id") on delete cascade;
|
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
9 |
alter table "project_location" add foreign key ("location") references "location"("id") on delete cascade;
|
|
eac38214183d
9830b81e1c79d212 Project locations
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
10 |
alter table "project_location" add unique("project","location");
|
| 99 | 11 |
|
12 |
-- service |
|
13 |
create table "service" ( |
|
14 |
"name" varchar(100) not null, |
|
15 |
"updated_at" timestamp not null, |
|
16 |
"id" bigint primary key not null, |
|
17 |
"to" timestamp, |
|
18 |
"state" bigint not null, |
|
19 |
"company" bigint not null, |
|
20 |
"note" varchar(10240), |
|
21 |
"from" timestamp not null, |
|
22 |
"created_at" timestamp not null, |
|
23 |
"created_by" bigint, |
|
24 |
"updated_by" bigint |
|
25 |
); |
|
26 |
create sequence "service_id_seq"; |
|
27 |
alter table "service" add foreign key ("company") references "company"("id");
|
|
28 |
alter table "service" add foreign key ("state") references "code_list_item"("id");
|
|
29 |
||
30 |
-- service payment |
|
31 |
create table "service_payment" ( |
|
32 |
"id" bigint primary key not null, |
|
33 |
"service" bigint not null, |
|
34 |
"direction" integer not null, |
|
35 |
"period" bigint not null, |
|
36 |
"amount" numeric(16,2) not null, |
|
37 |
"currency" bigint not null |
|
38 |
); |
|
39 |
create sequence "service_payment_id_seq"; |
|
40 |
alter table "service_payment" add foreign key ("service") references "service"("id") on delete cascade;
|
|
41 |
alter table "service_payment" add foreign key ("period") references "code_list_item"("id");
|
|
42 |
alter table "service_payment" add foreign key ("currency") references "code_list_item"("id");
|
|
43 |