mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 05:41:18 +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.
48 lines
928 B
SQL
48 lines
928 B
SQL
-- add back old registration columns
|
|
ALTER TABLE local_site
|
|
ADD COLUMN open_registration boolean NOT NULL DEFAULT TRUE;
|
|
|
|
ALTER TABLE local_site
|
|
ADD COLUMN require_application boolean NOT NULL DEFAULT TRUE;
|
|
|
|
-- regenerate their values
|
|
WITH subquery AS (
|
|
SELECT
|
|
registration_mode,
|
|
CASE WHEN registration_mode = 'closed' THEN
|
|
FALSE
|
|
ELSE
|
|
TRUE
|
|
END
|
|
FROM
|
|
local_site)
|
|
UPDATE
|
|
local_site
|
|
SET
|
|
open_registration = subquery.case
|
|
FROM
|
|
subquery;
|
|
|
|
WITH subquery AS (
|
|
SELECT
|
|
registration_mode,
|
|
CASE WHEN registration_mode = 'open' THEN
|
|
FALSE
|
|
ELSE
|
|
TRUE
|
|
END
|
|
FROM
|
|
local_site)
|
|
UPDATE
|
|
local_site
|
|
SET
|
|
require_application = subquery.case
|
|
FROM
|
|
subquery;
|
|
|
|
-- drop new column and type
|
|
ALTER TABLE local_site
|
|
DROP COLUMN registration_mode;
|
|
|
|
DROP TYPE registration_mode_enum;
|
|
|