]> git.donarmstrong.com Git - debbugs.git/blobdiff - sql/debbugs_schema.sql
add correspondent full name id
[debbugs.git] / sql / debbugs_schema.sql
index fc207c44a6128c4333801521218391a869fe9da2..e7a88906b9ec8914c79836fa4b477f6291cf7d26 100644 (file)
@@ -178,7 +178,9 @@ CREATE TABLE src_pkg (
        last_modified TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
        obsolete BOOLEAN NOT NULL DEFAULT FALSE,
        CONSTRAINT src_pkg_doesnt_alias_itself CHECK (id <> alias_of),
-       CONSTRAINT src_pkg_is_obsolete_if_disabled CHECK ((obsolete IS FALSE AND disabled='infinity'::timestamp with time zone) OR (obsolete IS TRUE AND disabled < 'infinity'::timestamp with time zone))
+       CONSTRAINT src_pkg_is_obsolete_if_disabled CHECK (
+          (obsolete IS FALSE AND disabled='infinity'::timestamp with time zone) OR
+          (obsolete IS TRUE AND disabled < 'infinity'::timestamp with time zone))
 );
 CREATE INDEX src_pkg_pkg ON src_pkg(pkg);
 CREATE UNIQUE INDEX src_pkg_pkg_null ON src_pkg(pkg) WHERE disabled='infinity'::timestamp with time zone;
@@ -294,7 +296,6 @@ INSERT INTO column_comments VALUES ('tag','tag','Tag name');
 INSERT INTO column_comments VALUES ('tag','obsolete','Whether a tag is obsolete (should not be set on new bugs)');
 
 CREATE TABLE bug_tag (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug,
        tag INT NOT NULL REFERENCES tag
 );
@@ -304,7 +305,6 @@ INSERT INTO column_comments VALUES ('bug_tag','tag','Tag id (matches tag)');
 
 CREATE UNIQUE INDEX bug_tag_bug_tag ON bug_tag (bug,tag);
 CREATE INDEX bug_tag_tag ON bug_tag (tag);
-CREATE INDEX bug_tag_bug ON bug_tag (bug);
 
 CREATE TABLE user_tag (
        id SERIAL PRIMARY KEY,
@@ -320,7 +320,6 @@ CREATE UNIQUE INDEX user_tag_tag_correspondent ON user_tag(tag,correspondent);
 CREATE INDEX user_tag_correspondent ON user_tag(correspondent);
 
 CREATE TABLE bug_user_tag (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug,
        user_tag INT NOT NULL REFERENCES user_tag
 );
@@ -330,10 +329,8 @@ INSERT INTO column_comments VALUES ('bug_user_tag','tag','User tag id (matches u
 
 CREATE UNIQUE INDEX bug_user_tag_bug_tag ON bug_user_tag (bug,user_tag);
 CREATE INDEX bug_user_tag_tag ON bug_user_tag (user_tag);
-CREATE INDEX bug_user_tag_bug ON bug_user_tag (bug);
 
 CREATE TABLE bug_binpackage (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug,
        bin_pkg INT NOT NULL REFERENCES bin_pkg ON UPDATE CASCADE ON DELETE CASCADE
 );
@@ -343,12 +340,10 @@ INSERT INTO column_comments VALUES ('bug_binpackage','bug','Bug id (matches bug)
 INSERT INTO column_comments VALUES ('bug_binpackage','bin_pkg','Binary package id (matches bin_pkg)');
 
 CREATE TABLE bug_srcpackage (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug,
        src_pkg INT NOT NULL REFERENCES src_pkg ON UPDATE CASCADE ON DELETE CASCADE
 );
 CREATE UNIQUE INDEX bug_srcpackage_id_pkg ON bug_srcpackage(bug,src_pkg);
-CREATE INDEX bug_srcpackage_idx_bug ON bug_srcpackage(bug);
 CREATE INDEX bug_srcpackage_idx_src_pkg ON bug_srcpackage(src_pkg);
 
 INSERT INTO table_comments VALUES ('bug_srcpackage','Bug <-> source package mapping');
@@ -360,7 +355,6 @@ CREATE VIEW bug_package (bug,pkg_id,pkg_type,package) AS
               SELECT s.bug,s.src_pkg,'source',sp.pkg FROM bug_srcpackage s JOIN src_pkg sp ON sp.id=s.src_pkg;
 
 CREATE TABLE bug_affects_binpackage (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug,
        bin_pkg INT NOT NULL REFERENCES bin_pkg ON UPDATE CASCADE ON DELETE CASCADE
 );
@@ -370,7 +364,6 @@ INSERT INTO column_comments VALUES ('bug_affects_binpackage','bug','Bug id (matc
 INSERT INTO column_comments VALUES ('bug_affects_binpackage','bin_pkg','Binary package id (matches bin_pkg)');
 
 CREATE TABLE bug_affects_srcpackage (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug,
        src_pkg INT NOT NULL REFERENCES src_pkg ON UPDATE CASCADE ON DELETE CASCADE
 );
@@ -438,7 +431,6 @@ CREATE UNIQUE INDEX src_associations_source_suite ON src_associations(source,sui
 
 CREATE TYPE bug_status_type AS ENUM ('pending','forwarded','pending-fixed','fixed','absent','done');
 CREATE TABLE bug_status_cache (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug ON DELETE CASCADE ON UPDATE CASCADE,
        suite INT REFERENCES suite ON DELETE CASCADE ON UPDATE CASCADE,
        arch INT REFERENCES arch ON DELETE CASCADE ON UPDATE CASCADE,
@@ -466,9 +458,7 @@ CREATE TABLE message (
        id SERIAL PRIMARY KEY,
        msgid TEXT NOT NULL DEFAULT '',
        from_complete TEXT NOT NULL DEFAULT '',
-       from_addr TEXT NOT NULL DEFAULT '',
        to_complete TEXT NOT NULL DEFAULT '',
-       to_addr TEXT NOT NULL DEFAULT '',
        subject TEXT NOT NULL DEFAULT '',
        sent_date TIMESTAMP WITH TIME ZONE,
        refs TEXT NOT NULL DEFAULT '',
@@ -479,9 +469,7 @@ INSERT INTO table_comments VALUES ('message','Messages sent to bugs');
 INSERT INTO column_comments VALUES ('message','id','Message id');
 INSERT INTO column_comments VALUES ('message','msgid','Message id header');
 INSERT INTO column_comments VALUES ('message','from_complete','Complete from header of message');
-INSERT INTO column_comments VALUES ('message','from_addr','Address(es) of From: headers');
 INSERT INTO column_comments VALUES ('message','to_complete','Complete to header of message');
-INSERT INTO column_comments VALUES ('message','to_addr','Address(es) of To: header');
 INSERT INTO column_comments VALUES ('message','subject','Subject of the message');
 INSERT INTO column_comments VALUES ('message','sent_date','Time/date message was sent (from Date header)');
 INSERT INTO column_comments VALUES ('message','refs','Contents of References: header');
@@ -493,7 +481,6 @@ CREATE UNIQUE INDEX message_msgid_from_complete_to_complete_subject_idx
 CREATE INDEX message_subject_idx ON message(subject);
 
 CREATE TABLE message_refs (
-       id SERIAL PRIMARY KEY,
        message INT NOT NULL REFERENCES message ON DELETE CASCADE ON UPDATE CASCADE,
        refs INT NOT NULL REFERENCES message ON DELETE CASCADE ON UPDATE CASCADE,
        inferred BOOLEAN DEFAULT FALSE,
@@ -512,7 +499,6 @@ INSERT INTO column_comments VALUES ('message_refs','primary_ref','TRUE if this m
 
 
 CREATE TABLE correspondent_full_name(
-       id SERIAL PRIMARY KEY,
        correspondent INT NOT NULL REFERENCES correspondent ON DELETE CASCADE ON UPDATE CASCADE,
        full_name TEXT NOT NULL,
        last_seen TIMESTAMP NOT NULL DEFAULT NOW()
@@ -522,14 +508,12 @@ CREATE UNIQUE INDEX correspondent_full_name_correspondent_full_name_idx
 CREATE INDEX correspondent_full_name_idx_full_name ON correspondent_full_name(full_name);
 CREATE INDEX correspondent_full_name_idx_last_seen ON correspondent_full_name(last_seen);
 INSERT INTO table_comments VALUES ('correspondent_full_name','Full names of BTS correspondents');
-INSERT INTO column_comments VALUES ('correspondent_full_name','id','Correspondent full name id');
-INSERT INTO column_comments VALUES ('correspondent_full_name','correpsondent','Correspondent ID (matches correspondent)');
+INSERT INTO column_comments VALUES ('correspondent_full_name','correspondent','Correspondent ID (matches correspondent)');
 INSERT INTO column_comments VALUES ('correspondent_full_name','full_name','Correspondent full name (includes e-mail address)');
 
 CREATE TYPE message_correspondent_type AS ENUM ('to','from','envfrom','cc');
 
 CREATE TABLE message_correspondent (
-       id SERIAL PRIMARY KEY,
        message INT NOT NULL REFERENCES message ON DELETE CASCADE ON UPDATE CASCADE,
        correspondent INT NOT NULL REFERENCES correspondent ON DELETE CASCADE ON UPDATE CASCADE,
        correspondent_type message_correspondent_type NOT NULL DEFAULT 'to'
@@ -545,7 +529,6 @@ CREATE INDEX message_correspondent_idx_correspondent ON message_correspondent(co
 CREATE INDEX message_correspondent_idx_message ON message_correspondent(message);
 
 CREATE TABLE bug_message (
-       id SERIAL PRIMARY KEY,
        bug INT NOT NULL REFERENCES bug ON DELETE CASCADE ON UPDATE CASCADE,
        message INT NOT NULL REFERENCES message ON DELETE CASCADE ON UPDATE CASCADE,
        message_number INT NOT NULL,