32 lines
628 B
MySQL
32 lines
628 B
MySQL
|
-- Deploy numerus:contact_swift to pg
|
||
|
-- requires: schema_numerus
|
||
|
-- requires: roles
|
||
|
-- requires: contact
|
||
|
-- requires: bic
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to numerus, public;
|
||
|
|
||
|
create table contact_swift (
|
||
|
contact_id integer primary key references contact,
|
||
|
bic bic not null
|
||
|
);
|
||
|
|
||
|
grant select, insert, update, delete on table contact_swift to invoicer;
|
||
|
grant select, insert, update, delete on table contact_swift to admin;
|
||
|
|
||
|
alter table contact_swift enable row level security;
|
||
|
|
||
|
create policy company_policy
|
||
|
on contact_swift
|
||
|
using (
|
||
|
exists(
|
||
|
select 1
|
||
|
from contact
|
||
|
where contact.contact_id = contact_swift.contact_id
|
||
|
)
|
||
|
);
|
||
|
|
||
|
commit;
|