1 DROP DATABASE projectb;
2 CREATE DATABASE projectb;
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 fingerprint (
32 id SERIAL PRIMARY KEY,
33 fingerprint TEXT UNIQUE NOT NULL
36 CREATE TABLE location (
37 id SERIAL PRIMARY KEY,
39 component INT4 REFERENCES component,
40 archive INT4 REFERENCES archive,
44 -- No references below here to allow sane population; added post-population
47 id SERIAL PRIMARY KEY,
48 filename TEXT NOT NULL,
51 location INT4 NOT NULL, -- REFERENCES location
53 unique (filename, location)
57 id SERIAL PRIMARY KEY,
59 version TEXT NOT NULL,
60 maintainer INT4 NOT NULL, -- REFERENCES maintainer
61 file INT4 UNIQUE NOT NULL, -- REFERENCES files
62 install_date TIMESTAMP NOT NULL,
63 sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
64 unique (source, version)
67 CREATE TABLE dsc_files (
68 id SERIAL PRIMARY KEY,
69 source INT4 NOT NULL, -- REFERENCES source,
70 file INT4 NOT NULL, -- RERENCES files
74 CREATE TABLE binaries (
75 id SERIAL PRIMARY KEY,
76 package TEXT NOT NULL,
77 version TEXT NOT NULL,
78 maintainer INT4 NOT NULL, -- REFERENCES maintainer
79 source INT4, -- REFERENCES source,
80 architecture INT4 NOT NULL, -- REFERENCES architecture
81 file INT4 UNIQUE NOT NULL, -- REFERENCES files,
83 -- joeyh@ doesn't want .udebs and .debs with the same name, which is why the unique () doesn't mention type
84 sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
85 unique (package, version, architecture)
89 id SERIAL PRIMARY KEY,
90 suite_name TEXT NOT NULL,
98 CREATE TABLE suite_architectures (
99 suite INT4 NOT NULL, -- REFERENCES suite
100 architecture INT4 NOT NULL, -- REFERENCES architecture
101 unique (suite, architecture)
104 CREATE TABLE bin_associations (
105 id SERIAL PRIMARY KEY,
106 suite INT4 NOT NULL, -- REFERENCES suite
107 bin INT4 NOT NULL, -- REFERENCES binaries
111 CREATE TABLE src_associations (
112 id SERIAL PRIMARY KEY,
113 suite INT4 NOT NULL, -- REFERENCES suite
114 source INT4 NOT NULL, -- REFERENCES source
115 unique (suite, source)
118 CREATE TABLE section (
119 id SERIAL PRIMARY KEY,
120 section TEXT UNIQUE NOT NULL
123 CREATE TABLE priority (
124 id SERIAL PRIMARY KEY,
125 priority TEXT UNIQUE NOT NULL,
126 level INT4 UNIQUE NOT NULL
129 CREATE TABLE override_type (
130 id SERIAL PRIMARY KEY,
131 type TEXT UNIQUE NOT NULL
134 CREATE TABLE override (
135 package TEXT NOT NULL,
136 suite INT4 NOT NULL, -- references suite
137 component INT4 NOT NULL, -- references component
138 priority INT4, -- references priority
139 section INT4 NOT NULL, -- references section
140 type INT4 NOT NULL, -- references override_type
142 unique (suite, component, package, type)
145 CREATE TABLE accepted_autobuild (
146 suite INT4 NOT NULL, -- references suite
147 filename TEXT NOT NULL,
148 in_accepted BOOLEAN NOT NULL,
154 CREATE INDEX bin_associations_bin ON bin_associations (bin);
155 CREATE INDEX src_associations_source ON src_associations (source);
156 CREATE INDEX source_maintainer ON source (maintainer);
157 CREATE INDEX binaries_maintainer ON binaries (maintainer);
158 CREATE INDEX binaries_fingerprint on binaries (sig_fpr);
159 CREATE INDEX source_fingerprint on source (sig_fpr);
160 CREATE INDEX dsc_files_file ON dsc_files (file);