mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-09-27 14:00:17 +00:00
be1389420b
* SQL format checking, 1. * SQL format checking, 2. * SQL format checking, 3. * SQL format checking, 4. * SQL format checking, 5. * Running pg_format * Getting rid of comment. * Upping pg_format version. * Using git ls-files for sql format check. * Fixing sql lints. * Addressing PR comments.
37 lines
741 B
SQL
37 lines
741 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__;
|
|
|