From e4f2d0b50aaaf78dba8ca82f757e19399e581e07 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 24 Nov 2013 17:15:39 -0800 Subject: [PATCH] Add id to bug_ver and some more indices --- Debbugs/DB/Result/BugVer.pm | 32 ++++++++++++++++++++++++++++-- Debbugs/DB/Result/Correspondent.pm | 8 ++++---- Debbugs/DB/Result/Maintainer.pm | 8 ++++---- Debbugs/DB/Result/Severity.pm | 8 ++++---- sql/debbugs_schema.sql | 5 ++++- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Debbugs/DB/Result/BugVer.pm b/Debbugs/DB/Result/BugVer.pm index 9d810e9..124d185 100644 --- a/Debbugs/DB/Result/BugVer.pm +++ b/Debbugs/DB/Result/BugVer.pm @@ -35,6 +35,15 @@ __PACKAGE__->table("bug_ver"); =head1 ACCESSORS +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'bug_ver_id_seq' + +Bug version id + =head2 bug data_type: 'integer' @@ -95,6 +104,13 @@ Time that this entry was modified =cut __PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "bug_ver_id_seq", + }, "bug", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "ver_string", @@ -121,6 +137,18 @@ __PACKAGE__->add_columns( }, ); +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + =head1 UNIQUE CONSTRAINTS =head2 C @@ -200,8 +228,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-21 21:57:41 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Yfu0BNTuEb3naSH/RR0YZA +# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yTXx9otJq7Ur+tbswRs8mQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/Correspondent.pm b/Debbugs/DB/Result/Correspondent.pm index 8646464..2bf83f9 100644 --- a/Debbugs/DB/Result/Correspondent.pm +++ b/Debbugs/DB/Result/Correspondent.pm @@ -79,7 +79,7 @@ __PACKAGE__->set_primary_key("id"); =head1 UNIQUE CONSTRAINTS -=head2 C +=head2 C =over 4 @@ -89,7 +89,7 @@ __PACKAGE__->set_primary_key("id"); =cut -__PACKAGE__->add_unique_constraint("correspondent_addr_key", ["addr"]); +__PACKAGE__->add_unique_constraint("correspondent_addr_idx", ["addr"]); =head1 RELATIONS @@ -184,8 +184,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Wyisfi/87NgArvWis4/tuw +# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iw5Rey49aurBMhqdnlKaiw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/Maintainer.pm b/Debbugs/DB/Result/Maintainer.pm index 801b19f..a15e55c 100644 --- a/Debbugs/DB/Result/Maintainer.pm +++ b/Debbugs/DB/Result/Maintainer.pm @@ -121,7 +121,7 @@ __PACKAGE__->set_primary_key("id"); =head1 UNIQUE CONSTRAINTS -=head2 C +=head2 C =over 4 @@ -131,7 +131,7 @@ __PACKAGE__->set_primary_key("id"); =cut -__PACKAGE__->add_unique_constraint("maintainer_name_key", ["name"]); +__PACKAGE__->add_unique_constraint("maintainer_name_idx", ["name"]); =head1 RELATIONS @@ -166,8 +166,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-21 21:57:41 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E1iNr1IKDcHDQYtmVdsoHA +# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5E4fT7G2x7wdPfr7SMqgGg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/Severity.pm b/Debbugs/DB/Result/Severity.pm index 5a50252..34366e3 100644 --- a/Debbugs/DB/Result/Severity.pm +++ b/Debbugs/DB/Result/Severity.pm @@ -109,7 +109,7 @@ __PACKAGE__->set_primary_key("id"); =head1 UNIQUE CONSTRAINTS -=head2 C +=head2 C =over 4 @@ -119,7 +119,7 @@ __PACKAGE__->set_primary_key("id"); =cut -__PACKAGE__->add_unique_constraint("severity_severity_key", ["severity"]); +__PACKAGE__->add_unique_constraint("severity_severity_idx", ["severity"]); =head1 RELATIONS @@ -139,8 +139,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-03-27 19:35:10 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SVJ20W+hu/tjDthRG38xtA +# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xZN34NjFy5iDRay5w6JYVQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/sql/debbugs_schema.sql b/sql/debbugs_schema.sql index 8b126bd..e1e0628 100644 --- a/sql/debbugs_schema.sql +++ b/sql/debbugs_schema.sql @@ -212,6 +212,7 @@ INSERT INTO column_comments VALUES ('src_ver','based_on','Source package version CREATE TABLE bug_ver ( + id SERIAL PRIMARY KEY, bug INT NOT NULL REFERENCES bug ON UPDATE CASCADE ON DELETE RESTRICT, ver_string TEXT, @@ -228,6 +229,7 @@ CREATE INDEX bug_ver_src_pkg_id_src_ver_id_idx ON bug_ver(src_pkg,src_ver); CREATE INDEX bug_ver_src_ver_id_idx ON bug_ver(src_ver); CREATE UNIQUE INDEX ON bug_ver(bug,ver_string,found); INSERT INTO table_comments VALUES ('bug_ver','Bug versions'); +INSERT INTO column_comments VALUES ('bug_ver','id','Bug version id'); INSERT INTO column_comments VALUES ('bug_ver','bug','Bug number'); INSERT INTO column_comments VALUES ('bug_ver','ver_string','Version string'); INSERT INTO column_comments VALUES ('bug_ver','src_pkg','Source package id (matches src_pkg table)'); @@ -430,7 +432,6 @@ INSERT INTO column_comments VALUES ('message','sent_date','Time/date message was INSERT INTO column_comments VALUES ('message','refs','Contents of References: header'); INSERT INTO column_comments VALUES ('message','spam_score','Spam score from spamassassin'); INSERT INTO column_comments VALUES ('message','is_spam','True if this message was spam and should not be shown'); - CREATE INDEX ON message(msgid); CREATE TABLE message_refs ( @@ -491,6 +492,8 @@ CREATE TABLE bug_message ( bug_log_offset INT, offset_valid TIMESTAMP WITH TIME ZONE ); +CREATE UNIQUE INDEX bug_message(bug,message); +CREATE INDEX bug_message(bug,message_number); INSERT INTO table_comments VALUES ('bug_mesage','Mapping between a bug and a message'); INSERT INTO column_comments VALUES ('bug_message','bug','Bug id (matches bug)'); INSERT INTO column_comments VALUES ('bug_message','message','Message id (matches message)'); -- 2.39.2