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
31 CREATE TABLE src_uploaders (
32 id SERIAL PRIMARY KEY,
33 source INT4 NOT NULL REFERENCES source,
34 maintainer INT4 NOT NULL REFERENCES maintainer
38 id SERIAL PRIMARY KEY,
39 uid TEXT UNIQUE NOT NULL,
43 CREATE TABLE keyrings (
44 id SERIAL PRIMARY KEY,
49 CREATE TABLE fingerprint (
50 id SERIAL PRIMARY KEY,
51 fingerprint TEXT UNIQUE NOT NULL,
52 uid INT4 REFERENCES uid,
53 keyring INT4 REFERENCES keyrings
56 CREATE TABLE location (
57 id SERIAL PRIMARY KEY,
59 component INT4 REFERENCES component,
60 archive INT4 REFERENCES archive,
64 -- No references below here to allow sane population; added post-population
67 id SERIAL PRIMARY KEY,
68 filename TEXT NOT NULL,
71 location INT4 NOT NULL, -- REFERENCES location
73 unique (filename, location)
77 id SERIAL PRIMARY KEY,
79 version TEXT NOT NULL,
80 maintainer INT4 NOT NULL, -- REFERENCES maintainer
81 file INT4 UNIQUE NOT NULL, -- REFERENCES files
82 install_date TIMESTAMP NOT NULL,
83 sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
84 unique (source, version)
87 CREATE TABLE dsc_files (
88 id SERIAL PRIMARY KEY,
89 source INT4 NOT NULL, -- REFERENCES source,
90 file INT4 NOT NULL, -- RERENCES files
94 CREATE TABLE binaries (
95 id SERIAL PRIMARY KEY,
96 package TEXT NOT NULL,
97 version TEXT NOT NULL,
98 maintainer INT4 NOT NULL, -- REFERENCES maintainer
99 source INT4, -- REFERENCES source,
100 architecture INT4 NOT NULL, -- REFERENCES architecture
101 file INT4 UNIQUE NOT NULL, -- REFERENCES files,
103 -- joeyh@ doesn't want .udebs and .debs with the same name, which is why the unique () doesn't mention type
104 sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
105 unique (package, version, architecture)
109 id SERIAL PRIMARY KEY,
110 suite_name TEXT NOT NULL,
119 id SERIAL PRIMARY KEY,
120 queue_name TEXT NOT NULL
123 CREATE TABLE suite_architectures (
124 suite INT4 NOT NULL, -- REFERENCES suite
125 architecture INT4 NOT NULL, -- REFERENCES architecture
126 unique (suite, architecture)
129 CREATE TABLE bin_associations (
130 id SERIAL PRIMARY KEY,
131 suite INT4 NOT NULL, -- REFERENCES suite
132 bin INT4 NOT NULL, -- REFERENCES binaries
136 CREATE TABLE src_associations (
137 id SERIAL PRIMARY KEY,
138 suite INT4 NOT NULL, -- REFERENCES suite
139 source INT4 NOT NULL, -- REFERENCES source
140 unique (suite, source)
143 CREATE TABLE section (
144 id SERIAL PRIMARY KEY,
145 section TEXT UNIQUE NOT NULL
148 CREATE TABLE priority (
149 id SERIAL PRIMARY KEY,
150 priority TEXT UNIQUE NOT NULL,
151 level INT4 UNIQUE NOT NULL
154 CREATE TABLE override_type (
155 id SERIAL PRIMARY KEY,
156 type TEXT UNIQUE NOT NULL
159 CREATE TABLE override (
160 package TEXT NOT NULL,
161 suite INT4 NOT NULL, -- references suite
162 component INT4 NOT NULL, -- references component
163 priority INT4, -- references priority
164 section INT4 NOT NULL, -- references section
165 type INT4 NOT NULL, -- references override_type
167 unique (suite, component, package, type)
170 CREATE TABLE queue_build (
171 suite INT4 NOT NULL, -- references suite
172 queue INT4 NOT NULL, -- references queue
173 filename TEXT NOT NULL,
174 in_queue BOOLEAN NOT NULL,
180 CREATE INDEX bin_associations_bin ON bin_associations (bin);
181 CREATE INDEX src_associations_source ON src_associations (source);
182 CREATE INDEX source_maintainer ON source (maintainer);
183 CREATE INDEX binaries_maintainer ON binaries (maintainer);
184 CREATE INDEX binaries_fingerprint on binaries (sig_fpr);
185 CREATE INDEX source_fingerprint on source (sig_fpr);
186 CREATE INDEX dsc_files_file ON dsc_files (file);