mirror of
https://github.com/YunoHost-Apps/noalyss_ynh.git
synced 2024-09-03 19:46:20 +02:00
23 lines
659 B
MySQL
23 lines
659 B
MySQL
|
CREATE FUNCTION limit_user() RETURNS trigger
|
||
|
LANGUAGE plpgsql
|
||
|
AS $$
|
||
|
|
||
|
begin
|
||
|
NEW.ac_user := substring(NEW.ac_user from 1 for 80);
|
||
|
return NEW;
|
||
|
end; $$;
|
||
|
CREATE FUNCTION upgrade_repo(p_version integer) RETURNS void
|
||
|
LANGUAGE plpgsql
|
||
|
AS $$
|
||
|
declare
|
||
|
is_mono integer;
|
||
|
begin
|
||
|
select count (*) into is_mono from information_schema.tables where table_name='repo_version';
|
||
|
if is_mono = 1 then
|
||
|
update repo_version set val=p_version;
|
||
|
else
|
||
|
update version set val=p_version;
|
||
|
end if;
|
||
|
end;
|
||
|
$$;
|