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