]> Untitled Git - lemmy.git/blob - migrations/2022-10-06-183632_move_blocklist_to_db/down.sql
Optimize hot rank updates (#3617)
[lemmy.git] / migrations / 2022-10-06-183632_move_blocklist_to_db / down.sql
1 -- Add back site columns
2 alter table site
3   add column enable_downvotes boolean default true not null,
4   add column open_registration boolean default true not null,
5   add column enable_nsfw boolean default true not null,
6   add column community_creation_admin_only boolean default false not null,
7   add column require_email_verification boolean default false not null,
8   add column require_application boolean default true not null,
9   add column application_question text default 'to verify that you are human, please explain why you want to create an account on this site'::text,
10   add column private_instance boolean default false not null,
11   add column default_theme text default 'browser'::text not null,
12   add column default_post_listing_type text default 'Local'::text not null,
13   add column legal_information text,
14   add column hide_modlog_mod_names boolean default true not null,
15   add column application_email_admins boolean default false not null;
16
17 -- Insert the data back from local_site
18 update site set
19   enable_downvotes = ls.enable_downvotes,
20   open_registration = ls.open_registration,
21   enable_nsfw = ls.enable_nsfw,
22   community_creation_admin_only = ls.community_creation_admin_only,
23   require_email_verification = ls.require_email_verification,
24   require_application = ls.require_application,
25   application_question = ls.application_question,
26   private_instance = ls.private_instance,
27   default_theme = ls.default_theme,
28   default_post_listing_type = ls.default_post_listing_type,
29   legal_information = ls.legal_information,
30   hide_modlog_mod_names = ls.hide_modlog_mod_names,
31   application_email_admins = ls.application_email_admins,
32   published = ls.published,
33   updated = ls.updated
34 from (select 
35   site_id, 
36   enable_downvotes,
37   open_registration,
38   enable_nsfw,
39   community_creation_admin_only,
40   require_email_verification,
41   require_application,
42   application_question,
43   private_instance,
44   default_theme,
45   default_post_listing_type,
46   legal_information,
47   hide_modlog_mod_names,
48   application_email_admins,
49   published,
50   updated
51 from local_site) as ls
52 where site.id = ls.site_id;
53
54 -- drop instance columns
55 alter table site drop column instance_id;
56 alter table person drop column instance_id;
57 alter table community drop column instance_id;
58
59 drop table local_site_rate_limit;
60 drop table local_site;
61 drop table federation_allowlist;
62 drop table federation_blocklist;
63 drop table instance;