mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-09-27 05:50:03 +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.
34 lines
678 B
SQL
34 lines
678 B
SQL
-- update the default sort type
|
|
UPDATE
|
|
local_user
|
|
SET
|
|
default_sort_type = 'TopDay'
|
|
WHERE
|
|
default_sort_type IN ('TopHour', 'TopSixHour', 'TopTwelveHour');
|
|
|
|
-- 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'
|
|
);
|
|
|
|
-- 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__;
|
|
|