DROP DATABASE projectb;
-CREATE DATABASE projectb;
+CREATE DATABASE projectb WITH ENCODING = 'SQL_ASCII';
\c projectb
);
CREATE TABLE maintainer (
- id SERIAL PRIMARY KEY,
+ id SERIAL PRIMARY KEY,
name TEXT UNIQUE NOT NULL
);
+CREATE TABLE uid (
+ id SERIAL PRIMARY KEY,
+ uid TEXT UNIQUE NOT NULL
+);
+
+CREATE TABLE fingerprint (
+ id SERIAL PRIMARY KEY,
+ fingerprint TEXT UNIQUE NOT NULL,
+ uid INT4 REFERENCES uid
+);
+
CREATE TABLE location (
id SERIAL PRIMARY KEY,
path TEXT NOT NULL,
version TEXT NOT NULL,
maintainer INT4 NOT NULL, -- REFERENCES maintainer
file INT4 UNIQUE NOT NULL, -- REFERENCES files
+ install_date TIMESTAMP NOT NULL,
+ sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
unique (source, version)
);
file INT4 UNIQUE NOT NULL, -- REFERENCES files,
type TEXT NOT NULL,
-- joeyh@ doesn't want .udebs and .debs with the same name, which is why the unique () doesn't mention type
- unique (package, version, source, architecture)
+ sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
+ unique (package, version, architecture)
);
CREATE TABLE suite (
id SERIAL PRIMARY KEY,
suite_name TEXT NOT NULL,
- version TEXT NOT NULL,
+ version TEXT,
origin TEXT,
label TEXT,
policy_engine TEXT,
description TEXT
);
-
+
CREATE TABLE suite_architectures (
suite INT4 NOT NULL, -- REFERENCES suite
architecture INT4 NOT NULL, -- REFERENCES architecture
unique (suite, architecture)
);
-
+
CREATE TABLE bin_associations (
id SERIAL PRIMARY KEY,
suite INT4 NOT NULL, -- REFERENCES suite
source INT4 NOT NULL, -- REFERENCES source
unique (suite, source)
);
+
+CREATE TABLE section (
+ id SERIAL PRIMARY KEY,
+ section TEXT UNIQUE NOT NULL
+);
+
+CREATE TABLE priority (
+ id SERIAL PRIMARY KEY,
+ priority TEXT UNIQUE NOT NULL,
+ level INT4 UNIQUE NOT NULL
+);
+
+CREATE TABLE override_type (
+ id SERIAL PRIMARY KEY,
+ type TEXT UNIQUE NOT NULL
+);
+
+CREATE TABLE override (
+ package TEXT NOT NULL,
+ suite INT4 NOT NULL, -- references suite
+ component INT4 NOT NULL, -- references component
+ priority INT4, -- references priority
+ section INT4 NOT NULL, -- references section
+ type INT4 NOT NULL, -- references override_type
+ maintainer TEXT,
+ unique (suite, component, package, type)
+);
+
+CREATE TABLE accepted_autobuild (
+ suite INT4 NOT NULL, -- references suite
+ filename TEXT NOT NULL,
+ in_accepted BOOLEAN NOT NULL,
+ last_used TIMESTAMP
+);
+
+-- Critical indexes
+
+CREATE INDEX bin_associations_bin ON bin_associations (bin);
+CREATE INDEX src_associations_source ON src_associations (source);
+CREATE INDEX source_maintainer ON source (maintainer);
+CREATE INDEX binaries_maintainer ON binaries (maintainer);
+CREATE INDEX binaries_fingerprint on binaries (sig_fpr);
+CREATE INDEX source_fingerprint on source (sig_fpr);
+CREATE INDEX dsc_files_file ON dsc_files (file);