136 "created_at" timestamp not null, |
136 "created_at" timestamp not null, |
137 "created_by" bigint, |
137 "created_by" bigint, |
138 "updated_by" bigint |
138 "updated_by" bigint |
139 ); |
139 ); |
140 create sequence "bank_account_id_seq"; |
140 create sequence "bank_account_id_seq"; |
|
141 create table "company_contact" ( |
|
142 "contact" bigint not null, |
|
143 "entity" bigint not null |
|
144 ); |
141 -- foreign key constraints : |
145 -- foreign key constraints : |
142 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id"); |
146 alter table "address" add constraint "addressFK1" foreign key ("city_id") references "city"("id"); |
143 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id"); |
147 alter table "city" add constraint "cityFK2" foreign key ("country_id") references "country"("id"); |
144 alter table "company" add constraint "companyFK3" foreign key ("address_id") references "address"("id"); |
148 alter table "company" add constraint "companyFK3" foreign key ("address_id") references "address"("id"); |
145 alter table "company" add constraint "companyFK4" foreign key ("post_adress_id") references "address"("id") on delete set null; |
149 alter table "company" add constraint "companyFK4" foreign key ("post_adress_id") references "address"("id") on delete set null; |
146 alter table "bank_account" add constraint "bank_accountFK5" foreign key ("company_id") references "company"("id") on delete cascade; |
150 alter table "bank_account" add constraint "bank_accountFK5" foreign key ("company_id") references "company"("id") on delete cascade; |
|
151 alter table "company_contact" add constraint "company_contactFK6" foreign key ("entity") references "company"("id") on delete cascade; |
|
152 alter table "company_contact" add constraint "company_contactFK7" foreign key ("contact") references "contact"("id") on delete cascade; |
|
153 -- composite key indexes : |
|
154 alter table "company_contact" add constraint "company_contactCPK" unique("entity","contact"); |
147 -- column group indexes : |
155 -- column group indexes : |
148 create index "user_deleted_active_idx" on "user" ("deleted","active"); |
156 create index "user_deleted_active_idx" on "user" ("deleted","active"); |