src/main/resources/db/db-schema.sql
changeset 98 eac38214183d
parent 92 eb207b189332
child 99 49eb72a46208
equal deleted inserted replaced
97:f6bdff1c40ed 98:eac38214183d
   203   );
   203   );
   204 create sequence "comment_id_seq";
   204 create sequence "comment_id_seq";
   205 create table "project_company" (
   205 create table "project_company" (
   206     "project" bigint not null,
   206     "project" bigint not null,
   207     "company" bigint not null
   207     "company" bigint not null
       
   208   );
       
   209 create table "project_location" (
       
   210     "location" bigint not null,
       
   211     "project" bigint not null
   208   );
   212   );
   209 -- foreign key constraints :
   213 -- foreign key constraints :
   210 alter table "address" add foreign key ("city_id") references "city"("id");
   214 alter table "address" add foreign key ("city_id") references "city"("id");
   211 alter table "city" add foreign key ("country_id") references "country"("id");
   215 alter table "city" add foreign key ("country_id") references "country"("id");
   212 alter table "location" add foreign key ("address_id") references "address"("id");
   216 alter table "location" add foreign key ("address_id") references "address"("id");
   226 alter table "company_contact" add foreign key ("contact") references "contact"("id") on delete cascade;
   230 alter table "company_contact" add foreign key ("contact") references "contact"("id") on delete cascade;
   227 alter table "user_contact" add foreign key ("entity") references "user"("id") on delete cascade;
   231 alter table "user_contact" add foreign key ("entity") references "user"("id") on delete cascade;
   228 alter table "user_contact" add foreign key ("contact") references "contact"("id") on delete cascade;
   232 alter table "user_contact" add foreign key ("contact") references "contact"("id") on delete cascade;
   229 alter table "project_company" add foreign key ("project") references "project"("id") on delete cascade;
   233 alter table "project_company" add foreign key ("project") references "project"("id") on delete cascade;
   230 alter table "project_company" add foreign key ("company") references "company"("id") on delete cascade;
   234 alter table "project_company" add foreign key ("company") references "company"("id") on delete cascade;
       
   235 alter table "project_location" add foreign key ("project") references "project"("id") on delete cascade;
       
   236 alter table "project_location" add foreign key ("location") references "location"("id") on delete cascade;
   231 -- composite key indexes :
   237 -- composite key indexes :
   232 alter table "company_contact" add unique("entity","contact");
   238 alter table "company_contact" add unique("entity","contact");
   233 alter table "user_contact" add unique("entity","contact");
   239 alter table "user_contact" add unique("entity","contact");
   234 alter table "project_company" add unique("project","company");
   240 alter table "project_company" add unique("project","company");
       
   241 alter table "project_location" add unique("project","location");
   235 -- column group indexes :
   242 -- column group indexes :
   236 create index "user_deleted_active_idx" on "user" ("deleted","active");
   243 create index "user_deleted_active_idx" on "user" ("deleted","active");