2019-08-30 11:06:36 -04:00
|
|
|
--Storing as json b, create column defined as jsonb
|
|
|
|
--This contains the award name and award year
|
2019-08-30 08:17:21 -04:00
|
|
|
ALTER TABLE buildings
|
2019-08-30 11:06:36 -04:00
|
|
|
ADD COLUMN IF NOT EXISTS team_awards jsonb;
|
2019-08-15 10:08:02 -04:00
|
|
|
|
2019-08-30 11:06:36 -04:00
|
|
|
--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
|
2019-08-30 08:17:21 -04:00
|
|
|
ALTER TABLE buildings
|
2019-08-30 11:06:36 -04:00
|
|
|
ADD CONSTRAINT data_is_valid CHECK (is_jsonb_valid ('{"type": "object"}', team_awards));
|