numerus/revert/available_invoice_status.sql

29 lines
797 B
PL/PgSQL

-- Deploy numerus:available_invoice_status to pg
-- requires: schema_numerus
-- requires: invoice_status
-- requires: invoice_status_i18n
begin;
set search_path to numerus;
update invoice set invoice_status = 'created' where invoice_status = 'partial';
delete from invoice_status_i18n where invoice_status = 'partial';
delete from invoice_status where invoice_status = 'partial';
insert into invoice_status (invoice_status, name)
values ('sent', 'Sent')
, ('unpaid', 'Unpaid')
on conflict (invoice_status) do nothing
;
insert into invoice_status_i18n (invoice_status, lang_tag, name)
values ('sent', 'ca', 'Enviada')
, ('unpaid', 'ca', 'No cobrada')
, ('sent', 'es', 'Enviada')
, ('unpaid', 'es', 'No cobrada')
on conflict (invoice_status, lang_tag) do nothing
;
commit;