-- Deploy camper:invoice_product_tax to pg -- requires: schema_camper -- requires: invoice_product -- requires: tax -- requires: tax_rate begin; set search_path to camper, public; create table invoice_product_tax ( invoice_product_id integer not null references invoice_product, tax_id integer not null references tax, tax_rate tax_rate not null, primary key (invoice_product_id, tax_id) ); grant select, insert, update, delete on table invoice_product_tax to employee; grant select, insert, update, delete on table invoice_product_tax to admin; alter table invoice_product_tax enable row level security; create policy company_policy on invoice_product_tax using ( exists( select 1 from invoice_product where invoice_product.invoice_product_id = invoice_product_tax.invoice_product_id ) ); commit;