numerus/deploy/product_tax.sql

32 lines
649 B
MySQL
Raw Permalink Normal View History

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