199 "created_at" timestamp not null, |
199 "created_at" timestamp not null, |
200 "created_by" bigint, |
200 "created_by" bigint, |
201 "updated_by" bigint |
201 "updated_by" bigint |
202 ); |
202 ); |
203 create sequence "comment_id_seq"; |
203 create sequence "comment_id_seq"; |
|
204 create table "project_company" ( |
|
205 "project" bigint not null, |
|
206 "company" bigint not null |
|
207 ); |
204 -- foreign key constraints : |
208 -- foreign key constraints : |
205 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id"); |
209 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id"); |
206 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id"); |
210 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id"); |
207 alter table "location" add constraint "locationFK3" foreign key ("address_id") references "address"("id"); |
211 alter table "location" add constraint "locationFK3" foreign key ("address_id") references "address"("id"); |
208 alter table "company" add constraint "companyFK4" foreign key ("address_id") references "address"("id"); |
212 alter table "company" add constraint "companyFK4" foreign key ("address_id") references "address"("id"); |
218 alter table "comment" add constraint "commentFK18" foreign key ("task_id") references "task"("id") on delete cascade; |
222 alter table "comment" add constraint "commentFK18" foreign key ("task_id") references "task"("id") on delete cascade; |
219 alter table "company_contact" add constraint "company_contactFK7" foreign key ("entity") references "company"("id") on delete cascade; |
223 alter table "company_contact" add constraint "company_contactFK7" foreign key ("entity") references "company"("id") on delete cascade; |
220 alter table "company_contact" add constraint "company_contactFK8" foreign key ("contact") references "contact"("id") on delete cascade; |
224 alter table "company_contact" add constraint "company_contactFK8" foreign key ("contact") references "contact"("id") on delete cascade; |
221 alter table "user_contact" add constraint "user_contactFK9" foreign key ("entity") references "user"("id") on delete cascade; |
225 alter table "user_contact" add constraint "user_contactFK9" foreign key ("entity") references "user"("id") on delete cascade; |
222 alter table "user_contact" add constraint "user_contactFK10" foreign key ("contact") references "contact"("id") on delete cascade; |
226 alter table "user_contact" add constraint "user_contactFK10" foreign key ("contact") references "contact"("id") on delete cascade; |
|
227 alter table "project_company" add constraint "project_companyFK19" foreign key ("project") references "project"("id") on delete cascade; |
|
228 alter table "project_company" add constraint "project_companyFK20" foreign key ("company") references "company"("id") on delete cascade; |
223 -- composite key indexes : |
229 -- composite key indexes : |
224 alter table "company_contact" add constraint "company_contactCPK" unique("entity","contact"); |
230 alter table "company_contact" add constraint "company_contactCPK" unique("entity","contact"); |
225 alter table "user_contact" add constraint "user_contactCPK" unique("entity","contact"); |
231 alter table "user_contact" add constraint "user_contactCPK" unique("entity","contact"); |
|
232 alter table "project_company" add constraint "project_companyCPK" unique("project","company"); |
226 -- column group indexes : |
233 -- column group indexes : |
227 create index "user_deleted_active_idx" on "user" ("deleted","active"); |
234 create index "user_deleted_active_idx" on "user" ("deleted","active"); |