Merge pull request #408 from colouring-london/features/migrations_team

Features/migrations team
This commit is contained in:
Tom Russell 2020-04-09 10:32:29 +01:00 committed by GitHub
commit 58cd5a2070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

2
.gitignore vendored
View File

@ -18,6 +18,8 @@ etl/**/*.xls
etl/**/*.xlsx
etl/**/*.zip
.DS_Store
# Cache
app/tilecache/**/*.png
app/tilecache/**/*.mbtiles

View File

@ -0,0 +1,3 @@
-- Remove team fields, update in paralell with adding new fields
-- Award or awards (may be multiple) stored as json b object
ALTER TABLE buildings DROP COLUMN IF EXISTS team_awards;

View File

@ -0,0 +1,8 @@
--Storing as json b, create column defined as jsonb
--This contains the award name and award year
ALTER TABLE buildings
ADD COLUMN IF NOT EXISTS team_awards jsonb;
--To validate this input, the following confirms it's an valid object but not that the items in the object are validated agains those we will acccept
ALTER TABLE buildings
ADD CONSTRAINT data_is_valid CHECK (is_jsonb_valid ('{"type": "object"}', team_awards));