diff -r 39d3fc08414c -r 494b3b9db463 db/db-schema.sql --- a/db/db-schema.sql Tue May 01 23:32:41 2012 +0200 +++ b/db/db-schema.sql Tue May 01 23:54:09 2012 +0200 @@ -113,6 +113,7 @@ "id" bigint primary key not null, "ico" varchar(40) not null, "note" varchar(10240), + "status" bigint not null, "created_at" timestamp not null, "created_by" bigint, "address_id" bigint not null, @@ -209,23 +210,24 @@ alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id"); alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id"); alter table "location" add constraint "locationFK3" foreign key ("address_id") references "address"("id"); -alter table "company" add constraint "companyFK4" foreign key ("address_id") references "address"("id"); -alter table "company" add constraint "companyFK5" foreign key ("post_adress_id") references "address"("id") on delete set null; -alter table "bank_account" add constraint "bank_accountFK6" foreign key ("company_id") references "company"("id") on delete cascade; -alter table "project" add constraint "projectFK11" foreign key ("responsible") references "user"("id"); -alter table "project" add constraint "projectFK12" foreign key ("product_line") references "code_list_item"("id") on delete set null; -alter table "project" add constraint "projectFK13" foreign key ("state") references "code_list_item"("id"); -alter table "task" add constraint "taskFK14" foreign key ("responsible") references "user"("id"); -alter table "task" add constraint "taskFK15" foreign key ("task_type") references "code_list_item"("id"); -alter table "task" add constraint "taskFK16" foreign key ("state") references "code_list_item"("id"); -alter table "task" add constraint "taskFK17" foreign key ("project_id") references "project"("id"); -alter table "comment" add constraint "commentFK18" foreign key ("task_id") references "task"("id") on delete cascade; -alter table "company_contact" add constraint "company_contactFK7" foreign key ("entity") references "company"("id") on delete cascade; -alter table "company_contact" add constraint "company_contactFK8" foreign key ("contact") references "contact"("id") on delete cascade; -alter table "user_contact" add constraint "user_contactFK9" foreign key ("entity") references "user"("id") on delete cascade; -alter table "user_contact" add constraint "user_contactFK10" foreign key ("contact") references "contact"("id") on delete cascade; -alter table "project_company" add constraint "project_companyFK19" foreign key ("project") references "project"("id") on delete cascade; -alter table "project_company" add constraint "project_companyFK20" foreign key ("company") references "company"("id") on delete cascade; +alter table "company" add constraint "companyFK4" foreign key ("status") references "code_list_item"("id"); +alter table "company" add constraint "companyFK5" foreign key ("address_id") references "address"("id"); +alter table "company" add constraint "companyFK6" foreign key ("post_adress_id") references "address"("id") on delete set null; +alter table "bank_account" add constraint "bank_accountFK7" foreign key ("company_id") references "company"("id") on delete cascade; +alter table "project" add constraint "projectFK12" foreign key ("responsible") references "user"("id"); +alter table "project" add constraint "projectFK13" foreign key ("product_line") references "code_list_item"("id") on delete set null; +alter table "project" add constraint "projectFK14" foreign key ("state") references "code_list_item"("id"); +alter table "task" add constraint "taskFK15" foreign key ("responsible") references "user"("id"); +alter table "task" add constraint "taskFK16" foreign key ("task_type") references "code_list_item"("id"); +alter table "task" add constraint "taskFK17" foreign key ("state") references "code_list_item"("id"); +alter table "task" add constraint "taskFK18" foreign key ("project_id") references "project"("id"); +alter table "comment" add constraint "commentFK19" foreign key ("task_id") references "task"("id") on delete cascade; +alter table "company_contact" add constraint "company_contactFK8" foreign key ("entity") references "company"("id") on delete cascade; +alter table "company_contact" add constraint "company_contactFK9" foreign key ("contact") references "contact"("id") on delete cascade; +alter table "user_contact" add constraint "user_contactFK10" foreign key ("entity") references "user"("id") on delete cascade; +alter table "user_contact" add constraint "user_contactFK11" foreign key ("contact") references "contact"("id") on delete cascade; +alter table "project_company" add constraint "project_companyFK20" foreign key ("project") references "project"("id") on delete cascade; +alter table "project_company" add constraint "project_companyFK21" foreign key ("company") references "company"("id") on delete cascade; -- composite key indexes : alter table "company_contact" add constraint "company_contactCPK" unique("entity","contact"); alter table "user_contact" add constraint "user_contactCPK" unique("entity","contact");