X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=setup%2Finit_pool.sql;h=6d295dbf1c60a0a032f6f6fbb3221a1a3597160a;hb=d36e2e1219a6c9ad9110bbdb779ca61dfb444c2c;hp=887771895bbe67bbcce4e8bbfa7d0ecdda2db836;hpb=7ee74dfab6b17e4e9b12011f60ba3058e31715e6;p=dak.git diff --git a/setup/init_pool.sql b/setup/init_pool.sql index 88777189..6d295dbf 100644 --- a/setup/init_pool.sql +++ b/setup/init_pool.sql @@ -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) ); @@ -76,6 +84,7 @@ CREATE TABLE source ( file INT4 UNIQUE NOT NULL, -- REFERENCES files install_date TIMESTAMP NOT NULL, sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint + dm-upload-allowed BOOLEAN NOT NULL, unique (source, version) ); @@ -185,3 +194,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 = '' +);