-- Deploy numerus:invoice_tag to pg -- requires: schema_numerus -- requires: tag -- requires: invoice begin; set search_path to numerus, public; create table invoice_tag ( invoice_id integer not null references invoice, tag_id integer not null references tag, primary key (invoice_id, tag_id) ); grant select, insert, update, delete on table invoice_tag to invoicer; grant select, insert, update, delete on table invoice_tag to admin; alter table invoice_tag enable row level security; create policy company_policy on invoice_tag using ( exists( select 1 from invoice where invoice.invoice_id = invoice_tag.invoice_id ) ); commit;