initial support for tag extra options

tag_extra table in schema
report tag extras in taginfo and buildconfig
This commit is contained in:
Mike McLean 2015-06-04 12:05:57 -04:00
parent 22f720f085
commit ba7eb75886
2 changed files with 56 additions and 19 deletions

View file

@ -371,6 +371,22 @@ CREATE TABLE tag_config (
UNIQUE (tag_id,active)
) WITHOUT OIDS;
CREATE TABLE tag_extra (
tag_id INTEGER NOT NULL REFERENCES tag(id),
key TEXT NOT NULL,
value TEXT NOT NULL, -- TODO - move this to jsonb when we can
-- versioned - see desc above
create_event INTEGER NOT NULL REFERENCES events(id) DEFAULT get_event(),
revoke_event INTEGER REFERENCES events(id),
creator_id INTEGER NOT NULL REFERENCES users(id),
revoker_id INTEGER REFERENCES users(id),
active BOOLEAN DEFAULT 'true' CHECK (active),
CONSTRAINT active_revoke_sane CHECK (
(active IS NULL AND revoke_event IS NOT NULL AND revoker_id IS NOT NULL)
OR (active IS NOT NULL AND revoke_event IS NULL AND revoker_id IS NULL)),
PRIMARY KEY (create_event, tag_id, key),
UNIQUE (tag_id, key, active)
) WITHOUT OIDS;
-- the tag_updates table provides a mechanism to indicate changes relevant to tag
-- that are not reflected in a versioned table. For example: builds changing volumes,