camper/deploy/setup_home.sql

25 lines
535 B
MySQL
Raw Normal View History

-- Deploy camper:setup_home to pg
-- requires: roles
-- requires: schema_camper
-- requires: home
begin;
set search_path to camper, public;
create or replace function setup_home(company integer, slogan text) returns void as
$$
insert into home (company_id, slogan)
values (company, coalesce(slogan, ''))
on conflict (company_id) do update
set slogan = excluded.slogan
;
$$
language sql
;
revoke execute on function setup_home(integer, text) from public;
grant execute on function setup_home(integer, text) to admin;
commit;