]> git.decadent.org.uk Git - dak.git/blobdiff - init_pool.sql
Add new top level directories
[dak.git] / init_pool.sql
index 8da4a79fdebb39bc5b7f9dbec408612e6aeb7187..2b67617c3414ab59a0048ccfe35049747c183753 100644 (file)
@@ -1,5 +1,5 @@
 DROP DATABASE projectb;
-CREATE DATABASE projectb;
+CREATE DATABASE projectb WITH ENCODING = 'SQL_ASCII';
 
 \c projectb
 
@@ -24,10 +24,21 @@ CREATE TABLE architecture (
 );
 
 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,
@@ -54,6 +65,8 @@ CREATE TABLE source (
         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)
 );
 
@@ -74,25 +87,31 @@ CREATE TABLE binaries (
        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 queue (
+       id SERIAL PRIMARY KEY,
+       queue_name TEXT NOT NULL
+);
+
 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
@@ -106,3 +125,48 @@ CREATE TABLE src_associations (
        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 queue_build (
+       suite INT4 NOT NULL, -- references suite
+       queue INT4 NOT NULL, -- references queue
+       filename TEXT NOT NULL,
+       in_queue 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);