This is the same as a payment, but the user is the payee instead of the payer. I used a different relation than payment because i do not know any other way to encode the constraint that only invoices can have a collection, while expenses have only payments. Besides the name and the fact that they are related to invoices, a collection is pretty much the same as a payment.
23 lines
511 B
PL/PgSQL
23 lines
511 B
PL/PgSQL
-- Verify numerus:collection on pg
|
|
|
|
begin;
|
|
|
|
select collection_id
|
|
, company_id
|
|
, slug
|
|
, description
|
|
, collection_date
|
|
, payment_account_id
|
|
, amount
|
|
, currency_code
|
|
, tags
|
|
, payment_status
|
|
, created_at
|
|
from numerus.collection
|
|
where false;
|
|
|
|
select 1 / count(*) from pg_class where oid = 'numerus.collection'::regclass and relrowsecurity;
|
|
select 1 / count(*) from pg_policy where polname = 'company_policy' and polrelid = 'numerus.collection'::regclass;
|
|
|
|
rollback;
|