blob: adc1b622e4e1b556a083bb66f4f2c9e06ce4a5f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
drop function auth.user_toggle_active (
p_id bigint
);
create or replace function auth.user_toggle_active (
p_id bigint
)
returns bigint
as $$
declare
l_id bigint;
begin
select u.id into l_id
from auth.users u
where u.id = p_id;
if(l_id is not null) then
update auth.users
set active = not active
where id = p_id;
select u.id into l_id
from auth.users u
where u.id = p_id;
return l_id;
else
return null;
end if;
end;
$$ language plpgsql;
|