numerus/deploy/quote_amount.sql

24 lines
517 B
PL/PgSQL

-- Deploy numerus:quote_amount to pg
-- requires: roles
-- requires: schema_numerus
-- requires: quote_product
-- requires: quote_product_amount
begin;
set search_path to numerus, public;
create or replace view quote_amount as
select quote_id
, sum(subtotal)::integer as subtotal
, sum(total)::integer as total
from quote_product
join quote_product_amount using (quote_product_id)
group by quote_id
;
grant select on table quote_amount to invoicer;
grant select on table quote_amount to admin;
commit;