colouring-montreal/migrations/unreleased/0xx.team.up.sql
Mateusz Konieczny cf90e052ed fix some typos
2023-01-04 13:17:56 +01:00

9 lines
434 B
SQL

--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 against those we will accept
ALTER TABLE buildings
ADD CONSTRAINT data_is_valid CHECK (is_jsonb_valid ('{"type": "object"}', team_awards));