cg br schema pass 1

This commit is contained in:
Mike McLean 2015-04-09 15:29:16 -04:00
parent a80ab75b32
commit e1f928af6b
3 changed files with 44 additions and 3 deletions

View file

@ -464,16 +464,52 @@ create table tag_external_repos (
-- here we track the buildroots on the machines
CREATE TABLE buildroot (
id SERIAL NOT NULL PRIMARY KEY,
br_type INTEGER NOT NULL
) WITHOUT OIDS;
CREATE TABLE standard_buildroot (
buildroot_id INTEGER NOT NULL PRIMARY KEY REFERENCES buildroot(id),
host_id INTEGER NOT NULL REFERENCES host(id),
repo_id INTEGER NOT NULL REFERENCES repo (id),
arch VARCHAR(16) NOT NULL,
task_id INTEGER NOT NULL REFERENCES task (id),
create_event INTEGER NOT NULL REFERENCES events(id) DEFAULT get_event(),
retire_event INTEGER,
state INTEGER,
dirtyness INTEGER
state INTEGER
) WITHOUT OIDS;
CREATE TABLE buildroot_host_info (
buildroot_id INTEGER NOT NULL PRIMARY KEY REFERENCES buildroot(id),
os TEXT NOT NULL,
arch TEXT NOT NULL
) WITHOUT OIDS;
CREATE TABLE buildroot_cg_info (
buildroot_id INTEGER NOT NULL PRIMARY KEY REFERENCES buildroot(id),
name TEXT NOT NULL,
version TEXT NOT NULL
) WITHOUT OIDS;
CREATE TABLE buildroot_container_info (
buildroot_id INTEGER NOT NULL PRIMARY KEY REFERENCES buildroot(id),
ctype TEXT NOT NULL,
arch TEXT NOT NULL
) WITHOUT OIDS;
CREATE TABLE buildroot_tools_info (
buildroot_id INTEGER NOT NULL REFERENCES buildroot(id),
tool TEXT NOT NULL,
version TEXT NOT NULL,
PRIMARY KEY (buildroot_id, tool)
) WITHOUT OIDS;
CREATE TABLE buildroot_extra_info (
buildroot_id INTEGER NOT NULL PRIMARY KEY REFERENCES buildroot(id),
info TEXT NOT NULL
-- ^ we'll eventually make this a json type when we require newer postgres
) WITHOUT OIDS;
-- track spun images (livecds, installation, VMs...)
CREATE TABLE image_builds (
build_id INTEGER NOT NULL PRIMARY KEY REFERENCES build(id)

View file

@ -4100,7 +4100,7 @@ def query_buildroots(hostID=None, tagID=None, state=None, rpmID=None, archiveID=
queryOpts - query options
"""
fields = [('buildroot.id', 'id'), ('buildroot.arch', 'arch'), ('buildroot.state', 'state'),
('buildroot.dirtyness', 'dirtyness'), ('buildroot.task_id', 'task_id'),
('buildroot.task_id', 'task_id'),
('host.id', 'host_id'), ('host.name', 'host_name'),
('repo.id', 'repo_id'), ('repo.state', 'repo_state'),
('tag.id', 'tag_id'), ('tag.name', 'tag_name'),

View file

@ -210,6 +210,11 @@ BR_STATES = Enum((
'EXPIRED',
))
BR_TYPES = Enum((
'STANDARD',
'EXTERNAL',
))
TAG_UPDATE_TYPES = Enum((
'VOLUME_CHANGE',
'IMPORT',