-- Deploy numerus:tag_invoice to pg
-- requires: schema_numerus
-- requires: tag_name
-- requires: tag_invoice
-- requires: invoice_tag

begin;

set search_path to numerus, public;

create or replace function tag_invoice(company_id integer, invoice_id integer, tags tag_name[]) returns void as
$$
	select tag_relation('invoice_tag', 'invoice_id', company_id, invoice_id, tags);
$$
	language sql;

revoke execute on function tag_invoice(integer, integer, tag_name[]) from public;
grant execute on function tag_invoice(integer, integer, tag_name[]) to invoicer;
grant execute on function tag_invoice(integer, integer, tag_name[]) to admin;

commit;
