]> Untitled Git - lemmy.git/blob - migrations/2022-12-05-110642_registration_mode/down.sql
Feature add hours as sorting options backend (#3161)
[lemmy.git] / migrations / 2022-12-05-110642_registration_mode / down.sql
1 -- add back old registration columns
2 alter table local_site add column open_registration boolean not null default true;
3 alter table local_site add column require_application boolean not null default true;
4
5 -- regenerate their values
6 with subquery as (
7     select registration_mode,
8         case
9             when registration_mode='closed' then false
10             else true
11         end
12     from local_site
13 )
14 update local_site
15 set open_registration = subquery.case
16 from subquery;
17 with subquery as (
18     select registration_mode,
19         case
20             when registration_mode='open' then false
21             else true
22         end
23     from local_site
24 )
25 update local_site
26 set require_application = subquery.case
27 from subquery;
28
29 -- drop new column and type
30 alter table local_site drop column registration_mode;
31 drop type registration_mode_enum;