25 lines
535 B
MySQL
25 lines
535 B
MySQL
|
-- Deploy camper:order_seasons to pg
|
||
|
-- requires: schema_camper
|
||
|
-- requires: roles
|
||
|
-- requires: season
|
||
|
|
||
|
begin;
|
||
|
|
||
|
set search_path to camper, public;
|
||
|
|
||
|
create or replace function order_seasons(positions uuid[]) returns void as
|
||
|
$$
|
||
|
update season
|
||
|
set position = cast(temp.position as integer)
|
||
|
from unnest(positions) with ordinality as temp(slug, position)
|
||
|
where season.slug = temp.slug
|
||
|
;
|
||
|
$$
|
||
|
language sql
|
||
|
;
|
||
|
|
||
|
revoke execute on function order_seasons(uuid[]) from public;
|
||
|
grant execute on function order_seasons(uuid[]) to admin;
|
||
|
|
||
|
commit;
|