157 create index "user_login_idx" on "user" ("login"); |
157 create index "user_login_idx" on "user" ("login"); |
158 create table "user_contact" ( |
158 create table "user_contact" ( |
159 "contact" bigint not null, |
159 "contact" bigint not null, |
160 "entity" bigint not null |
160 "entity" bigint not null |
161 ); |
161 ); |
|
162 create table "project" ( |
|
163 "name" varchar(100) not null, |
|
164 "updated_at" timestamp not null, |
|
165 "id" bigint primary key not null, |
|
166 "description" varchar(40960) not null, |
|
167 "responsible" bigint not null, |
|
168 "deadline" timestamp not null, |
|
169 "ident_s" varchar(256) not null, |
|
170 "state" bigint not null, |
|
171 "note" varchar(10240), |
|
172 "product_line" bigint, |
|
173 "created_at" timestamp not null, |
|
174 "created_by" bigint, |
|
175 "updated_by" bigint |
|
176 ); |
|
177 create sequence "project_id_seq"; |
162 -- foreign key constraints : |
178 -- foreign key constraints : |
163 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id"); |
179 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id"); |
164 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id"); |
180 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id"); |
165 alter table "location" add constraint "locationFK3" foreign key ("address_id") references "address"("id"); |
181 alter table "location" add constraint "locationFK3" foreign key ("address_id") references "address"("id"); |
166 alter table "company" add constraint "companyFK4" foreign key ("address_id") references "address"("id"); |
182 alter table "company" add constraint "companyFK4" foreign key ("address_id") references "address"("id"); |
167 alter table "company" add constraint "companyFK5" foreign key ("post_adress_id") references "address"("id") on delete set null; |
183 alter table "company" add constraint "companyFK5" foreign key ("post_adress_id") references "address"("id") on delete set null; |
168 alter table "bank_account" add constraint "bank_accountFK6" foreign key ("company_id") references "company"("id") on delete cascade; |
184 alter table "bank_account" add constraint "bank_accountFK6" foreign key ("company_id") references "company"("id") on delete cascade; |
|
185 alter table "project" add constraint "projectFK11" foreign key ("responsible") references "user"("id"); |
|
186 alter table "project" add constraint "projectFK12" foreign key ("product_line") references "code_list_item"("id") on delete set null; |
|
187 alter table "project" add constraint "projectFK13" foreign key ("state") references "code_list_item"("id"); |
169 alter table "company_contact" add constraint "company_contactFK7" foreign key ("entity") references "company"("id") on delete cascade; |
188 alter table "company_contact" add constraint "company_contactFK7" foreign key ("entity") references "company"("id") on delete cascade; |
170 alter table "company_contact" add constraint "company_contactFK8" foreign key ("contact") references "contact"("id") on delete cascade; |
189 alter table "company_contact" add constraint "company_contactFK8" foreign key ("contact") references "contact"("id") on delete cascade; |
171 alter table "user_contact" add constraint "user_contactFK9" foreign key ("entity") references "user"("id") on delete cascade; |
190 alter table "user_contact" add constraint "user_contactFK9" foreign key ("entity") references "user"("id") on delete cascade; |
172 alter table "user_contact" add constraint "user_contactFK10" foreign key ("contact") references "contact"("id") on delete cascade; |
191 alter table "user_contact" add constraint "user_contactFK10" foreign key ("contact") references "contact"("id") on delete cascade; |
173 -- composite key indexes : |
192 -- composite key indexes : |