-- Deploy camper:add_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 add_season(company integer, name text, color color) returns uuid as $$
	insert into season (company_id, name, color)
	values (company, name, to_integer(color))
	returning slug
	;
$$
	language sql
;

revoke execute on function add_season(integer, text, color) from public;
grant execute on function add_season(integer, text, color) to admin;

commit;
