| author | Tomas Zeman <tzeman@volny.cz> |
| Fri, 20 Apr 2012 08:26:23 +0200 | |
| changeset 65 | a35a0edf9ddd |
| parent 61 | b65843860274 |
| child 69 | b1dc0efd1303 |
| 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 |
); |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
63 |
create sequence "city_id_seq"; |
| 36 | 64 |
create table "address" ( |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
65 |
"city_id" bigint not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
66 |
"name" varchar(100) not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
67 |
"updated_at" timestamp not null, |
| 36 | 68 |
"id" bigint primary key not null, |
69 |
"zip_code" varchar(100) not null, |
|
70 |
"street_name" varchar(100) not null, |
|
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
71 |
"note" varchar(10240), |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
72 |
"created_at" timestamp not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
73 |
"created_by" bigint, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
74 |
"street_num" varchar(100) not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
75 |
"updated_by" bigint |
| 36 | 76 |
); |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
77 |
create sequence "address_id_seq"; |
| 36 | 78 |
create table "country" ( |
79 |
"iso3" varchar(3) not null, |
|
80 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
81 |
"updated_at" timestamp not null, |
| 36 | 82 |
"id" bigint primary key not null, |
83 |
"iso2" varchar(2) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
84 |
"note" varchar(10240), |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
85 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
86 |
"created_by" bigint, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
87 |
"updated_by" bigint |
| 36 | 88 |
); |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
89 |
create sequence "country_id_seq"; |
| 36 | 90 |
create table "contact" ( |
91 |
"name" varchar(100) not null, |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
92 |
"updated_at" timestamp not null, |
| 36 | 93 |
"id" bigint primary key not null, |
94 |
"work_mobile" varchar(40) not null, |
|
95 |
"private_mail" varchar(256), |
|
96 |
"last_name" varchar(80) not null, |
|
97 |
"work_mail" varchar(256) not null, |
|
98 |
"first_name" varchar(80) not null, |
|
99 |
"fax" varchar(40), |
|
100 |
"note" varchar(10240), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
101 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
102 |
"created_by" bigint, |
| 36 | 103 |
"other_mail" varchar(256), |
104 |
"position" varchar(40), |
|
105 |
"other_mobile" varchar(40), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
106 |
"updated_by" bigint, |
| 36 | 107 |
"private_mobile" varchar(40), |
108 |
"private_phone" varchar(40), |
|
109 |
"work_phone" varchar(40) |
|
110 |
); |
|
111 |
create sequence "contact_id_seq"; |
|
112 |
create table "company" ( |
|
113 |
"name" varchar(100) not null, |
|
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
114 |
"dic" varchar(40) not null, |
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
115 |
"updated_at" timestamp not null, |
| 36 | 116 |
"id" bigint primary key not null, |
117 |
"ico" varchar(40) not null, |
|
118 |
"note" varchar(10240), |
|
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
119 |
"created_at" timestamp not null, |
|
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
120 |
"created_by" bigint, |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
121 |
"address_id" bigint not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
122 |
"post_adress_id" bigint, |
|
61
b65843860274
Trackable entity: created/updated fields
Tomas Zeman <tzeman@volny.cz>
parents:
56
diff
changeset
|
123 |
"updated_by" bigint, |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
124 |
"pin" integer not null |
| 36 | 125 |
); |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
126 |
create sequence "company_id_seq"; |
| 36 | 127 |
create table "bank_account" ( |
128 |
"number" bigint not null, |
|
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
129 |
"name" varchar(100) not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
130 |
"updated_at" timestamp not null, |
| 36 | 131 |
"id" bigint primary key not null, |
132 |
"prefix" bigint not null, |
|
133 |
"bank_code" varchar(100) not null, |
|
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
134 |
"company_id" bigint not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
135 |
"note" varchar(10240), |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
136 |
"created_at" timestamp not null, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
137 |
"created_by" bigint, |
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
138 |
"updated_by" bigint |
| 36 | 139 |
); |
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
140 |
create sequence "bank_account_id_seq"; |
| 36 | 141 |
-- foreign key constraints : |
142 |
alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id");
|
|
143 |
alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id");
|
|
144 |
alter table "company" add constraint "companyFK3" foreign key ("address_id") references "address"("id");
|
|
|
65
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
145 |
alter table "company" add constraint "companyFK4" foreign key ("post_adress_id") references "address"("id");
|
|
a35a0edf9ddd
Geo+Company record refactoring
Tomas Zeman <tzeman@volny.cz>
parents:
61
diff
changeset
|
146 |
alter table "bank_account" add constraint "bank_accountFK5" foreign key ("company_id") references "company"("id") on delete cascade;
|
| 56 | 147 |
-- column group indexes : |
148 |
create index "user_deleted_active_idx" on "user" ("deleted","active");
|