2023-01-05 01:42:30 +00:00
|
|
|
-- add back old registration columns
|
2023-08-02 16:44:51 +00:00
|
|
|
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;
|
2023-01-05 01:42:30 +00:00
|
|
|
|
|
|
|
-- regenerate their values
|
2023-08-02 16:44:51 +00:00
|
|
|
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;
|
2023-01-05 01:42:30 +00:00
|
|
|
|
|
|
|
-- drop new column and type
|
2023-08-02 16:44:51 +00:00
|
|
|
ALTER TABLE local_site
|
|
|
|
DROP COLUMN registration_mode;
|
|
|
|
|
|
|
|
DROP TYPE registration_mode_enum;
|
|
|
|
|