--- a/db/db-schema.sql Fri Apr 20 08:44:28 2012 +0200
+++ b/db/db-schema.sql Fri Apr 20 08:44:36 2012 +0200
@@ -138,11 +138,19 @@
"updated_by" bigint
);
create sequence "bank_account_id_seq";
+create table "company_contact" (
+ "contact" bigint not null,
+ "entity" bigint not null
+ );
-- foreign key constraints :
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 "company" add constraint "companyFK3" foreign key ("address_id") references "address"("id");
alter table "company" add constraint "companyFK4" foreign key ("post_adress_id") references "address"("id") on delete set null;
alter table "bank_account" add constraint "bank_accountFK5" foreign key ("company_id") references "company"("id") on delete cascade;
+alter table "company_contact" add constraint "company_contactFK6" foreign key ("entity") references "company"("id") on delete cascade;
+alter table "company_contact" add constraint "company_contactFK7" foreign key ("contact") references "contact"("id") on delete cascade;
+-- composite key indexes :
+alter table "company_contact" add constraint "company_contactCPK" unique("entity","contact");
-- column group indexes :
create index "user_deleted_active_idx" on "user" ("deleted","active");