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
+ 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
);
CREATE TABLE override (
- package TEXT NOT NULL,
+ package TEXT NOT NULL,
suite INT4 NOT NULL, -- references suite
component INT4 NOT NULL, -- references component
priority INT4, -- references priority
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);