-- Deploy numerus:edit_payment_account_other to pg
-- requires: roles
-- requires: schema_numerus
-- requires: payment_account

begin;

set search_path to numerus, public;

create or replace function edit_payment_account_other(account_slug uuid, new_name text) returns uuid as
$$
	update payment_account
	set name = new_name
	where slug = account_slug
	  and payment_account_type = 'other'
	returning slug
	;
$$
	language sql
;

revoke execute on function edit_payment_account_other(uuid, text) from public;
grant execute on function edit_payment_account_other(uuid, text) to invoicer;
grant execute on function edit_payment_account_other(uuid, text) to admin;

commit;
