db/db-schema.sql
changeset 91 494b3b9db463
parent 85 3ef84ec492fa
equal deleted inserted replaced
90:39d3fc08414c 91:494b3b9db463
   111     "dic" varchar(40) not null,
   111     "dic" varchar(40) not null,
   112     "updated_at" timestamp not null,
   112     "updated_at" timestamp not null,
   113     "id" bigint primary key not null,
   113     "id" bigint primary key not null,
   114     "ico" varchar(40) not null,
   114     "ico" varchar(40) not null,
   115     "note" varchar(10240),
   115     "note" varchar(10240),
       
   116     "status" bigint not null,
   116     "created_at" timestamp not null,
   117     "created_at" timestamp not null,
   117     "created_by" bigint,
   118     "created_by" bigint,
   118     "address_id" bigint not null,
   119     "address_id" bigint not null,
   119     "post_adress_id" bigint,
   120     "post_adress_id" bigint,
   120     "updated_by" bigint,
   121     "updated_by" bigint,
   207   );
   208   );
   208 -- foreign key constraints :
   209 -- foreign key constraints :
   209 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id");
   210 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id");
   210 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id");
   211 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id");
   211 alter table "location" add constraint "locationFK3" foreign key ("address_id") references "address"("id");
   212 alter table "location" add constraint "locationFK3" foreign key ("address_id") references "address"("id");
   212 alter table "company" add constraint "companyFK4" foreign key ("address_id") references "address"("id");
   213 alter table "company" add constraint "companyFK4" foreign key ("status") references "code_list_item"("id");
   213 alter table "company" add constraint "companyFK5" foreign key ("post_adress_id") references "address"("id") on delete set null;
   214 alter table "company" add constraint "companyFK5" foreign key ("address_id") references "address"("id");
   214 alter table "bank_account" add constraint "bank_accountFK6" foreign key ("company_id") references "company"("id") on delete cascade;
   215 alter table "company" add constraint "companyFK6" foreign key ("post_adress_id") references "address"("id") on delete set null;
   215 alter table "project" add constraint "projectFK11" foreign key ("responsible") references "user"("id");
   216 alter table "bank_account" add constraint "bank_accountFK7" foreign key ("company_id") references "company"("id") on delete cascade;
   216 alter table "project" add constraint "projectFK12" foreign key ("product_line") references "code_list_item"("id") on delete set null;
   217 alter table "project" add constraint "projectFK12" foreign key ("responsible") references "user"("id");
   217 alter table "project" add constraint "projectFK13" foreign key ("state") references "code_list_item"("id");
   218 alter table "project" add constraint "projectFK13" foreign key ("product_line") references "code_list_item"("id") on delete set null;
   218 alter table "task" add constraint "taskFK14" foreign key ("responsible") references "user"("id");
   219 alter table "project" add constraint "projectFK14" foreign key ("state") references "code_list_item"("id");
   219 alter table "task" add constraint "taskFK15" foreign key ("task_type") references "code_list_item"("id");
   220 alter table "task" add constraint "taskFK15" foreign key ("responsible") references "user"("id");
   220 alter table "task" add constraint "taskFK16" foreign key ("state") references "code_list_item"("id");
   221 alter table "task" add constraint "taskFK16" foreign key ("task_type") references "code_list_item"("id");
   221 alter table "task" add constraint "taskFK17" foreign key ("project_id") references "project"("id");
   222 alter table "task" add constraint "taskFK17" foreign key ("state") references "code_list_item"("id");
   222 alter table "comment" add constraint "commentFK18" foreign key ("task_id") references "task"("id") on delete cascade;
   223 alter table "task" add constraint "taskFK18" foreign key ("project_id") references "project"("id");
   223 alter table "company_contact" add constraint "company_contactFK7" foreign key ("entity") references "company"("id") on delete cascade;
   224 alter table "comment" add constraint "commentFK19" foreign key ("task_id") references "task"("id") on delete cascade;
   224 alter table "company_contact" add constraint "company_contactFK8" foreign key ("contact") references "contact"("id") on delete cascade;
   225 alter table "company_contact" add constraint "company_contactFK8" foreign key ("entity") references "company"("id") on delete cascade;
   225 alter table "user_contact" add constraint "user_contactFK9" foreign key ("entity") references "user"("id") on delete cascade;
   226 alter table "company_contact" add constraint "company_contactFK9" 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 "user_contact" add constraint "user_contactFK10" foreign key ("entity") references "user"("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 "user_contact" add constraint "user_contactFK11" foreign key ("contact") references "contact"("id") on delete cascade;
   228 alter table "project_company" add constraint "project_companyFK20" foreign key ("company") references "company"("id") on delete cascade;
   229 alter table "project_company" add constraint "project_companyFK20" foreign key ("project") references "project"("id") on delete cascade;
       
   230 alter table "project_company" add constraint "project_companyFK21" foreign key ("company") references "company"("id") on delete cascade;
   229 -- composite key indexes :
   231 -- composite key indexes :
   230 alter table "company_contact" add constraint "company_contactCPK" unique("entity","contact");
   232 alter table "company_contact" add constraint "company_contactCPK" unique("entity","contact");
   231 alter table "user_contact" add constraint "user_contactCPK" unique("entity","contact");
   233 alter table "user_contact" add constraint "user_contactCPK" unique("entity","contact");
   232 alter table "project_company" add constraint "project_companyCPK" unique("project","company");
   234 alter table "project_company" add constraint "project_companyCPK" unique("project","company");
   233 -- column group indexes :
   235 -- column group indexes :