]> git.decadent.org.uk Git - dak.git/blobdiff - setup/init_pool.sql
Merged from ftpmaster
[dak.git] / setup / init_pool.sql
index 8797acd59b33c4c6b88c2ac6f4edbdef1459baa8..7a6e2a490b82f46b809f556e6b08414be02b844b 100644 (file)
@@ -78,12 +78,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,
@@ -184,3 +191,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 = ''
+);