lemmy/migrations/2023-06-20-191145_add_listingtype_sorttype_3_6_9_months_enums/down.sql
c-andy-candies ffc049078e
Fix missing sorting types (#3370)
* Fix missing sorting types

* Reordered sort_type_enum
2023-06-28 12:44:16 -04:00

15 lines
663 B
SQL

-- update the default sort type
update local_user set default_sort_type = 'TopDay' where default_sort_type in ('TopThreeMonths', 'TopSixMonths', 'TopNineMonths');
-- rename the old enum
alter type sort_type_enum rename to sort_type_enum__;
-- create the new enum
CREATE TYPE sort_type_enum AS ENUM ('Active', 'Hot', 'New', 'Old', 'TopDay', 'TopWeek', 'TopMonth', 'TopYear', 'TopAll', 'MostComments', 'NewComments', 'TopHour', 'TopSixHour', 'TopTwelveHour');
-- alter all you enum columns
alter table local_user
alter column default_sort_type type sort_type_enum using default_sort_type::text::sort_type_enum;
-- drop the old enum
drop type sort_type_enum__;