]> Untitled Git - lemmy.git/blob - migrations/2023-06-20-191145_add_listingtype_sorttype_3_6_9_months_enums/down.sql
Feature add three six and nine months options backend (#3226)
[lemmy.git] / migrations / 2023-06-20-191145_add_listingtype_sorttype_3_6_9_months_enums / down.sql
1 -- update the default sort type
2 update local_user set default_sort_type = 'TopDay' where default_sort_type in ('TopThreeMonths', 'TopSixMonths', 'TopNineMonths');
3
4 -- rename the old enum
5 alter type sort_type_enum rename to sort_type_enum__;
6 -- create the new enum
7 CREATE TYPE sort_type_enum AS ENUM ('Active', 'Hot', 'New', 'Old', 'TopDay', 'TopWeek', 'TopMonth', 'TopYear', 'TopAll', 'MostComments', 'NewComments');
8
9 -- alter all you enum columns
10 alter table local_user
11   alter column default_sort_type type sort_type_enum using default_sort_type::text::sort_type_enum;
12
13 -- drop the old enum
14 drop type sort_type_enum__;