1 DROP DATABASE projectb;
2 CREATE DATABASE projectb WITH ENCODING = 'SQL_ASCII';
8 name TEXT UNIQUE NOT NULL,
13 CREATE TABLE component (
14 id SERIAL PRIMARY KEY,
15 name TEXT UNIQUE NOT NULL,
20 CREATE TABLE architecture (
21 id SERIAL PRIMARY KEY,
22 arch_string TEXT UNIQUE NOT NULL,
26 CREATE TABLE maintainer (
27 id SERIAL PRIMARY KEY,
28 name TEXT UNIQUE NOT NULL
32 id SERIAL PRIMARY KEY,
33 uid TEXT UNIQUE NOT NULL
36 CREATE TABLE fingerprint (
37 id SERIAL PRIMARY KEY,
38 fingerprint TEXT UNIQUE NOT NULL,
39 uid INT4 REFERENCES uid
42 CREATE TABLE location (
43 id SERIAL PRIMARY KEY,
45 component INT4 REFERENCES component,
46 archive INT4 REFERENCES archive,
50 -- No references below here to allow sane population; added post-population
53 id SERIAL PRIMARY KEY,
54 filename TEXT NOT NULL,
57 location INT4 NOT NULL, -- REFERENCES location
59 unique (filename, location)
63 id SERIAL PRIMARY KEY,
65 version TEXT NOT NULL,
66 maintainer INT4 NOT NULL, -- REFERENCES maintainer
67 file INT4 UNIQUE NOT NULL, -- REFERENCES files
68 install_date TIMESTAMP NOT NULL,
69 sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
70 unique (source, version)
73 CREATE TABLE dsc_files (
74 id SERIAL PRIMARY KEY,
75 source INT4 NOT NULL, -- REFERENCES source,
76 file INT4 NOT NULL, -- RERENCES files
80 CREATE TABLE binaries (
81 id SERIAL PRIMARY KEY,
82 package TEXT NOT NULL,
83 version TEXT NOT NULL,
84 maintainer INT4 NOT NULL, -- REFERENCES maintainer
85 source INT4, -- REFERENCES source,
86 architecture INT4 NOT NULL, -- REFERENCES architecture
87 file INT4 UNIQUE NOT NULL, -- REFERENCES files,
89 -- joeyh@ doesn't want .udebs and .debs with the same name, which is why the unique () doesn't mention type
90 sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
91 unique (package, version, architecture)
95 id SERIAL PRIMARY KEY,
96 suite_name TEXT NOT NULL,
105 id SERIAL PRIMARY KEY,
106 queue_name TEXT NOT NULL
109 CREATE TABLE suite_architectures (
110 suite INT4 NOT NULL, -- REFERENCES suite
111 architecture INT4 NOT NULL, -- REFERENCES architecture
112 unique (suite, architecture)
115 CREATE TABLE bin_associations (
116 id SERIAL PRIMARY KEY,
117 suite INT4 NOT NULL, -- REFERENCES suite
118 bin INT4 NOT NULL, -- REFERENCES binaries
122 CREATE TABLE src_associations (
123 id SERIAL PRIMARY KEY,
124 suite INT4 NOT NULL, -- REFERENCES suite
125 source INT4 NOT NULL, -- REFERENCES source
126 unique (suite, source)
129 CREATE TABLE section (
130 id SERIAL PRIMARY KEY,
131 section TEXT UNIQUE NOT NULL
134 CREATE TABLE priority (
135 id SERIAL PRIMARY KEY,
136 priority TEXT UNIQUE NOT NULL,
137 level INT4 UNIQUE NOT NULL
140 CREATE TABLE override_type (
141 id SERIAL PRIMARY KEY,
142 type TEXT UNIQUE NOT NULL
145 CREATE TABLE override (
146 package TEXT NOT NULL,
147 suite INT4 NOT NULL, -- references suite
148 component INT4 NOT NULL, -- references component
149 priority INT4, -- references priority
150 section INT4 NOT NULL, -- references section
151 type INT4 NOT NULL, -- references override_type
153 unique (suite, component, package, type)
156 CREATE TABLE queue_build (
157 suite INT4 NOT NULL, -- references suite
158 queue INT4 NOT NULL, -- references queue
159 filename TEXT NOT NULL,
160 in_queue BOOLEAN NOT NULL,
166 CREATE INDEX bin_associations_bin ON bin_associations (bin);
167 CREATE INDEX src_associations_source ON src_associations (source);
168 CREATE INDEX source_maintainer ON source (maintainer);
169 CREATE INDEX binaries_maintainer ON binaries (maintainer);
170 CREATE INDEX binaries_fingerprint on binaries (sig_fpr);
171 CREATE INDEX source_fingerprint on source (sig_fpr);
172 CREATE INDEX dsc_files_file ON dsc_files (file);