]> git.decadent.org.uk Git - dak.git/blobdiff - setup/init_pool.sql
Revert "revert all my stupid commits, we'll try this again later when we have a test...
[dak.git] / setup / init_pool.sql
index e09cc98636697809fa415ac6e23b5955ba86f38c..1e3639406cf1c8f79b072a1eb90e13f3a070c995 100644 (file)
@@ -28,6 +28,12 @@ CREATE TABLE maintainer (
        name TEXT UNIQUE NOT NULL
 );
 
+CREATE TABLE src_uploaders (
+       id SERIAL PRIMARY KEY,
+       source INT4 NOT NULL REFERENCES source,
+       maintainer INT4 NOT NULL REFERENCES maintainer
+);
+
 CREATE TABLE uid (
        id SERIAL PRIMARY KEY,
        uid TEXT UNIQUE NOT NULL,
@@ -64,6 +70,8 @@ CREATE TABLE files (
        md5sum TEXT NOT NULL,
        location INT4 NOT NULL, -- REFERENCES location
        last_used TIMESTAMP,
+       sha1sum TEXT NOT NULL,
+       sha256sum TEXT NOT NULL,
        unique (filename, location)
 );
 
@@ -72,12 +80,19 @@ CREATE TABLE source (
         source TEXT NOT NULL,
         version TEXT NOT NULL,
         maintainer INT4 NOT NULL, -- REFERENCES maintainer
+        changedby 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)
 );
 
+CREATE TABLE src_uploaders (
+       id SERIAL PRIMARY KEY,
+       source INT4 NOT NULL REFERENCES source,
+       maintainer INT4 NOT NULL REFERENCES maintainer
+);
+
 CREATE TABLE dsc_files (
        id SERIAL PRIMARY KEY,
        source INT4 NOT NULL, -- REFERENCES source,
@@ -178,3 +193,19 @@ 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);
+
+-- Own function
+CREATE FUNCTION space_concat(text, text) RETURNS text
+    AS $_$select case
+WHEN $2 is null or $2 = '' THEN $1
+WHEN $1 is null or $1 = '' THEN $2
+ELSE $1 || ' ' || $2
+END$_$
+    LANGUAGE sql;
+
+CREATE AGGREGATE space_separated_list (
+    BASETYPE = text,
+    SFUNC = space_concat,
+    STYPE = text,
+    INITCOND = ''
+);