]> Untitled Git - lemmy.git/blob - migrations/2023-06-17-175955_add_listingtype_sorttype_hour_enums/down.sql
work around race condition on community fetch (#3414)
[lemmy.git] / migrations / 2023-06-17-175955_add_listingtype_sorttype_hour_enums / down.sql
1 -- update the default sort type
2 update local_user set default_sort_type = 'TopDay' where default_sort_type in ('TopHour', 'TopSixHour', 'TopTwelveHour');
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__;