camper/deploy/edit_season.sql

28 lines
653 B
MySQL
Raw Normal View History

-- Deploy camper:edit_season to pg
-- requires: roles
-- requires: schema_camper
-- requires: season
-- requires: color
-- requires: to_integer
begin;
set search_path to camper, public;
create or replace function edit_season(slug uuid, name text, color color, active boolean) returns uuid as $$
update season
set name = edit_season.name
, color = to_integer(edit_season.color)
, active = edit_season.active
where slug = edit_season.slug
returning slug
;
$$
language sql
;
revoke execute on function edit_season(uuid, text, color, boolean) from public;
grant execute on function edit_season(uuid, text, color, boolean) to admin;
commit;