| author | Tomas Zeman <tzeman@volny.cz> |
| Fri, 20 Apr 2012 08:26:22 +0200 | |
| changeset 61 | b65843860274 |
| parent 56 | 9409e7ab3f9d |
| child 65 | a35a0edf9ddd |
| permissions | -rw-r--r-- |
| 36 | 1 |
-- table declarations : |
2 |
create table "code_list_item" ( |
|
3 |
"l3" bigint not null, |
|
4 |
"l1" bigint not null, |
|
5 |
"i18n" boolean not null, |
|
6 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
7 |
"updated_at" timestamp not null, |
| 36 | 8 |
"ol2" bigint, |
9 |
"s3" varchar(200) not null, |
|
10 |
"id" bigint primary key not null, |
|
11 |
"oi1" integer, |
|
12 |
"rank" integer not null, |
|
13 |
"code_list" varchar(40) not null, |
|
14 |
"dflt" boolean not null, |
|
15 |
"s2" varchar(200) not null, |
|
16 |
"i3" integer not null, |
|
17 |
"os1" varchar(200), |
|
18 |
"ol1" bigint, |
|
19 |
"oi2" integer, |
|
20 |
"i1" integer not null, |
|
21 |
"s1" varchar(200) not null, |
|
22 |
"note" varchar(10240), |
|
23 |
"os2" varchar(200), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
24 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
25 |
"created_by" bigint, |
| 36 | 26 |
"i2" integer not null, |
27 |
"oi3" integer, |
|
28 |
"l2" bigint not null, |
|
29 |
"ol3" bigint, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
30 |
"updated_by" bigint, |
| 36 | 31 |
"os3" varchar(200), |
32 |
"deleted" boolean not null |
|
33 |
); |
|
34 |
create sequence "code_list_item_id_seq"; |
|
35 |
-- indexes on code_list_item |
|
36 |
create index "code_list_item_code_list_idx" on "code_list_item" ("code_list");
|
|
| 56 | 37 |
create table "user" ( |
38 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
39 |
"updated_at" timestamp not null, |
| 56 | 40 |
"id" bigint primary key not null, |
41 |
"note" varchar(10240), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
42 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
43 |
"created_by" bigint, |
| 56 | 44 |
"login" varchar(40) not null, |
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
45 |
"updated_by" bigint, |
| 56 | 46 |
"deleted" boolean not null, |
47 |
"active" boolean not null, |
|
48 |
"password" varchar(128) not null |
|
49 |
); |
|
50 |
create sequence "user_id_seq"; |
|
51 |
-- indexes on user |
|
52 |
create index "user_login_idx" on "user" ("login");
|
|
| 36 | 53 |
create table "city" ( |
54 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
55 |
"updated_at" timestamp not null, |
| 36 | 56 |
"id" bigint primary key not null, |
57 |
"country_id" bigint not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
58 |
"note" varchar(10240), |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
59 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
60 |
"created_by" bigint, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
61 |
"updated_by" bigint |
| 36 | 62 |
); |
63 |
create sequence "s_city_id"; |
|
64 |
create table "address" ( |
|
65 |
"id" bigint primary key not null, |
|
66 |
"city_id" bigint not null, |
|
67 |
"zip_code" varchar(100) not null, |
|
68 |
"street_name" varchar(100) not null, |
|
69 |
"street_num" varchar(100) not null |
|
70 |
); |
|
71 |
create sequence "s_address_id"; |
|
72 |
create table "country" ( |
|
73 |
"iso3" varchar(3) not null, |
|
74 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
75 |
"updated_at" timestamp not null, |
| 36 | 76 |
"id" bigint primary key not null, |
77 |
"iso2" varchar(2) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
78 |
"note" varchar(10240), |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
79 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
80 |
"created_by" bigint, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
81 |
"updated_by" bigint |
| 36 | 82 |
); |
83 |
create sequence "s_country_id"; |
|
84 |
create table "contact" ( |
|
85 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
86 |
"updated_at" timestamp not null, |
| 36 | 87 |
"id" bigint primary key not null, |
88 |
"work_mobile" varchar(40) not null, |
|
89 |
"private_mail" varchar(256), |
|
90 |
"last_name" varchar(80) not null, |
|
91 |
"work_mail" varchar(256) not null, |
|
92 |
"first_name" varchar(80) not null, |
|
93 |
"fax" varchar(40), |
|
94 |
"note" varchar(10240), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
95 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
96 |
"created_by" bigint, |
| 36 | 97 |
"other_mail" varchar(256), |
98 |
"position" varchar(40), |
|
99 |
"other_mobile" varchar(40), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
100 |
"updated_by" bigint, |
| 36 | 101 |
"private_mobile" varchar(40), |
102 |
"private_phone" varchar(40), |
|
103 |
"work_phone" varchar(40) |
|
104 |
); |
|
105 |
create sequence "contact_id_seq"; |
|
106 |
create table "company" ( |
|
107 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
108 |
"updated_at" timestamp not null, |
| 36 | 109 |
"id" bigint primary key not null, |
110 |
"partner" integer not null, |
|
111 |
"ico" varchar(40) not null, |
|
112 |
"note" varchar(10240), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
113 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
114 |
"created_by" bigint, |
| 36 | 115 |
"corresp_address_id" bigint, |
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
116 |
"updated_by" bigint, |
| 36 | 117 |
"pin" integer not null, |
118 |
"address_id" bigint not null |
|
119 |
); |
|
120 |
create sequence "s_company_id"; |
|
121 |
create table "bank_account" ( |
|
122 |
"number" bigint not null, |
|
123 |
"id" bigint primary key not null, |
|
124 |
"prefix" bigint not null, |
|
125 |
"bank_code" varchar(100) not null, |
|
126 |
"company_id" bigint not null |
|
127 |
); |
|
128 |
create sequence "s_bank_account_id"; |
|
129 |
-- foreign key constraints : |
|
130 |
alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id");
|
|
131 |
alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id");
|
|
132 |
alter table "company" add constraint "companyFK3" foreign key ("address_id") references "address"("id");
|
|
133 |
alter table "company" add constraint "companyFK4" foreign key ("corresp_address_id") references "address"("id");
|
|
134 |
alter table "bank_account" add constraint "bank_accountFK5" foreign key ("company_id") references "company"("id");
|
|
| 56 | 135 |
-- column group indexes : |
136 |
create index "user_deleted_active_idx" on "user" ("deleted","active");
|