Merge pull request #408 from colouring-london/features/migrations_team
Features/migrations team
This commit is contained in:
commit
58cd5a2070
2
.gitignore
vendored
2
.gitignore
vendored
@ -18,6 +18,8 @@ etl/**/*.xls
|
||||
etl/**/*.xlsx
|
||||
etl/**/*.zip
|
||||
|
||||
.DS_Store
|
||||
|
||||
# Cache
|
||||
app/tilecache/**/*.png
|
||||
app/tilecache/**/*.mbtiles
|
||||
|
3
migrations/0xx.team.down.sql
Normal file
3
migrations/0xx.team.down.sql
Normal 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;
|
8
migrations/0xx.team.up.sql
Normal file
8
migrations/0xx.team.up.sql
Normal 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));
|
Loading…
Reference in New Issue
Block a user