Replace State-owned by Government-owned

part of #734
This commit is contained in:
Mateusz Konieczny 2022-02-16 16:08:29 +01:00
parent 05bb5f36ae
commit d7def11d4f
3 changed files with 53 additions and 1 deletions

View File

@ -107,7 +107,7 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
title={dataFields.community_public_ownership.title} title={dataFields.community_public_ownership.title}
value={props.building.community_public_ownership} value={props.building.community_public_ownership}
options={[ options={[
'State-owned', 'Government-owned',
'Charity-owned', 'Charity-owned',
'Community-owned/cooperative', 'Community-owned/cooperative',
'Owned by other non-profit body', 'Owned by other non-profit body',

View File

@ -0,0 +1,26 @@
-- new enum value
ALTER TYPE public_ownership_type ADD VALUE IF NOT EXISTS 'State-owned' BEFORE 'Charity-owned';
-- convert existing values
UPDATE buildings
SET community_public_ownership = 'State-owned'
WHERE community_public_ownership = 'Government-owned';
CREATE TYPE public_ownership_type_new
AS ENUM (
'State-owned',
'Charity-owned',
'Community-owned/cooperative',
'Owned by other non-profit body',
'Not in public/community ownership'
);
-- Convert to the new type, casting via text representation
ALTER TABLE buildings
ALTER COLUMN community_public_ownership TYPE public_ownership_type_new
USING (community_public_ownership::text::public_ownership_type_new);
-- And swap the types
DROP TYPE public_ownership_type;
ALTER TYPE public_ownership_type_new RENAME TO public_ownership_type;

View File

@ -0,0 +1,26 @@
-- new enum value
ALTER TYPE public_ownership_type ADD VALUE IF NOT EXISTS 'Government-owned' BEFORE 'Charity-owned';
-- convert existing values
UPDATE buildings
SET community_public_ownership = 'Government-owned'
WHERE community_public_ownership = 'State-owned';
CREATE TYPE public_ownership_type_new
AS ENUM (
'Government-owned',
'Charity-owned',
'Community-owned/cooperative',
'Owned by other non-profit body',
'Not in public/community ownership'
);
-- Convert to the new type, casting via text representation
ALTER TABLE buildings
ALTER COLUMN community_public_ownership TYPE public_ownership_type_new
USING (community_public_ownership::text::public_ownership_type_new);
-- And swap the types
DROP TYPE public_ownership_type;
ALTER TYPE public_ownership_type_new RENAME TO public_ownership_type;