From e82ae2e77eca2fea1d5f1e5e57fa0f0dae9db2ca Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 28 Feb 2016 14:58:10 -0800 Subject: [PATCH] handle affects properly and upgrade schema --- Debbugs/DB/Result/Arch.pm | 8 +- Debbugs/DB/Result/BinAssociation.pm | 8 +- Debbugs/DB/Result/BinPkg.pm | 23 +++- Debbugs/DB/Result/BinVer.pm | 40 ++++++- Debbugs/DB/Result/BinaryVersion.pm | 19 +++- Debbugs/DB/Result/Bug.pm | 38 ++++++- Debbugs/DB/Result/BugBinpackage.pm | 10 +- Debbugs/DB/Result/BugBlock.pm | 8 +- Debbugs/DB/Result/BugMerged.pm | 8 +- Debbugs/DB/Result/BugMessage.pm | 8 +- Debbugs/DB/Result/BugPackage.pm | 14 ++- Debbugs/DB/Result/BugSrcpackage.pm | 8 +- Debbugs/DB/Result/BugStatusCache.pm | 8 +- Debbugs/DB/Result/BugTag.pm | 8 +- Debbugs/DB/Result/BugVer.pm | 8 +- Debbugs/DB/Result/Correspondent.pm | 8 +- Debbugs/DB/Result/CorrespondentFullName.pm | 8 +- Debbugs/DB/Result/Maintainer.pm | 8 +- Debbugs/DB/Result/Message.pm | 65 +++++++++--- Debbugs/DB/Result/MessageCorrespondent.pm | 8 +- Debbugs/DB/Result/MessageRef.pm | 8 +- Debbugs/DB/Result/Severity.pm | 8 +- Debbugs/DB/Result/SrcAssociation.pm | 8 +- Debbugs/DB/Result/SrcPkg.pm | 23 +++- Debbugs/DB/Result/SrcVer.pm | 8 +- Debbugs/DB/Result/Suite.pm | 8 +- Debbugs/DB/Result/Tag.pm | 8 +- bin/debbugs-installsql | 13 +-- sql/dbicdump.conf | 2 +- sql/dbicdump_command.sh | 3 +- sql/debbugs_schema.sql | 118 ++++++++++++--------- 31 files changed, 361 insertions(+), 159 deletions(-) diff --git a/Debbugs/DB/Result/Arch.pm b/Debbugs/DB/Result/Arch.pm index 854111c8..30450475 100644 --- a/Debbugs/DB/Result/Arch.pm +++ b/Debbugs/DB/Result/Arch.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -124,8 +126,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:P0rjB+6uN8ddIxIvVN6OFg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9pDiZg68Odz66DpCB9GpsA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BinAssociation.pm b/Debbugs/DB/Result/BinAssociation.pm index 7f32065d..02d923ef 100644 --- a/Debbugs/DB/Result/BinAssociation.pm +++ b/Debbugs/DB/Result/BinAssociation.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -153,8 +155,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:23:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zEtAfQAP6UdXRqAF3PaBGA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T7Jms1yHoqpzOdL4mnmBOA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BinPkg.pm b/Debbugs/DB/Result/BinPkg.pm index 861c7660..5747fe08 100644 --- a/Debbugs/DB/Result/BinPkg.pm +++ b/Debbugs/DB/Result/BinPkg.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -108,6 +110,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 bug_affects_binpackages + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "bug_affects_binpackages", + "Debbugs::DB::Result::BugAffectsBinpackage", + { "foreign.bin_pkg" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 bug_binpackages Type: has_many @@ -124,8 +141,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:k32MQX4vbBhX4m9+EqR7ww +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:My1zg7yJ4SSXL78poec5ag # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BinVer.pm b/Debbugs/DB/Result/BinVer.pm index fc7ce46f..7a71c091 100644 --- a/Debbugs/DB/Result/BinVer.pm +++ b/Debbugs/DB/Result/BinVer.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -107,6 +109,38 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("bin_ver_bin_pkg_id_arch_idx", ["bin_pkg", "arch", "ver"]); + +=head2 C + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("bin_ver_src_ver_id_arch_idx", ["src_ver", "arch"]); + =head1 RELATIONS =head2 arch @@ -170,8 +204,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:rPiyH454ztK18EaqQD45/w +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Jie49PiJahtnqmfkKQYtcw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BinaryVersion.pm b/Debbugs/DB/Result/BinaryVersion.pm index a959c826..57f6b5f1 100644 --- a/Debbugs/DB/Result/BinaryVersion.pm +++ b/Debbugs/DB/Result/BinaryVersion.pm @@ -21,11 +21,14 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); +__PACKAGE__->table_class("DBIx::Class::ResultSource::View"); =head1 TABLE: C @@ -90,9 +93,19 @@ __PACKAGE__->add_columns( ); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-03-27 18:54:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PiJglTBqLYRIi63gvGWIDQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fH11OTb1r9SS1Ps9tM6WPQ +__PACKAGE__->result_source_instance->view_definition(< +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -241,6 +243,36 @@ __PACKAGE__->set_primary_key("id"); =head1 RELATIONS +=head2 bug_affects_binpackages + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "bug_affects_binpackages", + "Debbugs::DB::Result::BugAffectsBinpackage", + { "foreign.bug" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 bug_affects_srcpackages + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "bug_affects_srcpackages", + "Debbugs::DB::Result::BugAffectsSrcpackage", + { "foreign.bug" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 bug_binpackages Type: has_many @@ -467,8 +499,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iaePW9PF93j30EB5iY9Bag +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rd0pst8cgR9UPi092sJebw # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; diff --git a/Debbugs/DB/Result/BugBinpackage.pm b/Debbugs/DB/Result/BugBinpackage.pm index 30e7eb17..63223df8 100644 --- a/Debbugs/DB/Result/BugBinpackage.pm +++ b/Debbugs/DB/Result/BugBinpackage.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -116,7 +118,7 @@ __PACKAGE__->belongs_to( "bin_pkg", "Debbugs::DB::Result::BinPkg", { id => "bin_pkg" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "CASCADE" }, ); =head2 bug @@ -135,8 +137,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:MEtrsZjULXyH4vcYA0C7Vw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FZAi6kX8ICe/ZJI0JEqZLg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BugBlock.pm b/Debbugs/DB/Result/BugBlock.pm index b175f23b..467ab684 100644 --- a/Debbugs/DB/Result/BugBlock.pm +++ b/Debbugs/DB/Result/BugBlock.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -135,8 +137,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5IuTgATXoFsL6XBFxDp5wg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Rkt0XlA4r2YFX0KnUZmS6A # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BugMerged.pm b/Debbugs/DB/Result/BugMerged.pm index 32435280..405b4482 100644 --- a/Debbugs/DB/Result/BugMerged.pm +++ b/Debbugs/DB/Result/BugMerged.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -135,8 +137,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GILRzg9MHEZ4k8h6aJxISA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HdGeCb1Fh2cU08+TTQVi/Q # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BugMessage.pm b/Debbugs/DB/Result/BugMessage.pm index d5587da8..b2aa87ca 100644 --- a/Debbugs/DB/Result/BugMessage.pm +++ b/Debbugs/DB/Result/BugMessage.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -162,8 +164,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-24 20:30:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j9PbT+q4tBJhimXl7TQgLg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gof8IcnKupbpDmbU39kx6A # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BugPackage.pm b/Debbugs/DB/Result/BugPackage.pm index 5ef0b8ab..b3d40b88 100644 --- a/Debbugs/DB/Result/BugPackage.pm +++ b/Debbugs/DB/Result/BugPackage.pm @@ -21,11 +21,14 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); +__PACKAGE__->table_class("DBIx::Class::ResultSource::View"); =head1 TABLE: C @@ -69,8 +72,13 @@ __PACKAGE__->add_columns( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0HCzRExM+h0kYmDmvij1pA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Ok2J+mjxvBcgdiqigiCBQA + +__PACKAGE__->result_source_instance->view_definition(< +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -135,8 +137,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:2UJYLvd4tWOUwUFbVvQYvg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rkrGE3oLGWe28oXEFt4UFg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BugStatusCache.pm b/Debbugs/DB/Result/BugStatusCache.pm index 94e29fa1..8aab04d3 100644 --- a/Debbugs/DB/Result/BugStatusCache.pm +++ b/Debbugs/DB/Result/BugStatusCache.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -233,8 +235,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JJbS0LgqkbWIAEzmSvzSxw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A4gA20BsSs2R4VKmUCRs/g # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BugTag.pm b/Debbugs/DB/Result/BugTag.pm index 53f0d94e..625f445d 100644 --- a/Debbugs/DB/Result/BugTag.pm +++ b/Debbugs/DB/Result/BugTag.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -135,8 +137,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:yh8eh6BKocWHrBrU5zJwtQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:g7sgOcROAtOdRa9vrI5gQg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/BugVer.pm b/Debbugs/DB/Result/BugVer.pm index 124d185e..3de7f4cf 100644 --- a/Debbugs/DB/Result/BugVer.pm +++ b/Debbugs/DB/Result/BugVer.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -228,8 +230,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yTXx9otJq7Ur+tbswRs8mQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cvdjFL2o+rBg2PfcintuNA # 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 2bf83f93..68ed39d9 100644 --- a/Debbugs/DB/Result/Correspondent.pm +++ b/Debbugs/DB/Result/Correspondent.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -184,8 +186,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iw5Rey49aurBMhqdnlKaiw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lFyRZdUZXsbDv0Xc6c4cAQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/CorrespondentFullName.pm b/Debbugs/DB/Result/CorrespondentFullName.pm index cce140a9..d4f73b09 100644 --- a/Debbugs/DB/Result/CorrespondentFullName.pm +++ b/Debbugs/DB/Result/CorrespondentFullName.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -136,8 +138,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-21 20:33:17 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cvA70xYSRFfzSAXK1z1QzQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rXiBbe/rMz4dOMgW5ZovWw # 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 a15e55cc..9157653c 100644 --- a/Debbugs/DB/Result/Maintainer.pm +++ b/Debbugs/DB/Result/Maintainer.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -166,8 +168,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5E4fT7G2x7wdPfr7SMqgGg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rkpgeXltH2wiC1Us7FIijw # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/Message.pm b/Debbugs/DB/Result/Message.pm index ef36a9e9..bc493f13 100644 --- a/Debbugs/DB/Result/Message.pm +++ b/Debbugs/DB/Result/Message.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -47,35 +49,40 @@ Message id =head2 msgid data_type: 'text' - is_nullable: 1 + default_value: (empty string) + is_nullable: 0 Message id header =head2 from_complete data_type: 'text' - is_nullable: 1 + default_value: (empty string) + is_nullable: 0 Complete from header of message =head2 from_addr data_type: 'text' - is_nullable: 1 + default_value: (empty string) + is_nullable: 0 Address(es) of From: headers =head2 to_complete data_type: 'text' - is_nullable: 1 + default_value: (empty string) + is_nullable: 0 Complete to header of message =head2 to_addr data_type: 'text' - is_nullable: 1 + default_value: (empty string) + is_nullable: 0 Address(es) of To: header @@ -105,7 +112,8 @@ Contents of References: header =head2 spam_score data_type: 'double precision' - is_nullable: 1 + default_value: 0 + is_nullable: 0 Spam score from spamassassin @@ -113,7 +121,7 @@ Spam score from spamassassin data_type: 'boolean' default_value: false - is_nullable: 1 + is_nullable: 0 True if this message was spam and should not be shown @@ -128,15 +136,15 @@ __PACKAGE__->add_columns( sequence => "message_id_seq", }, "msgid", - { data_type => "text", is_nullable => 1 }, + { data_type => "text", default_value => "", is_nullable => 0 }, "from_complete", - { data_type => "text", is_nullable => 1 }, + { data_type => "text", default_value => "", is_nullable => 0 }, "from_addr", - { data_type => "text", is_nullable => 1 }, + { data_type => "text", default_value => "", is_nullable => 0 }, "to_complete", - { data_type => "text", is_nullable => 1 }, + { data_type => "text", default_value => "", is_nullable => 0 }, "to_addr", - { data_type => "text", is_nullable => 1 }, + { data_type => "text", default_value => "", is_nullable => 0 }, "subject", { data_type => "text", default_value => "", is_nullable => 0 }, "sent_date", @@ -144,9 +152,9 @@ __PACKAGE__->add_columns( "refs", { data_type => "text", default_value => "", is_nullable => 0 }, "spam_score", - { data_type => "double precision", is_nullable => 1 }, + { data_type => "double precision", default_value => 0, is_nullable => 0 }, "is_spam", - { data_type => "boolean", default_value => \"false", is_nullable => 1 }, + { data_type => "boolean", default_value => \"false", is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -161,6 +169,29 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key("id"); +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint( + "message_msgid_from_complete_to_complete_subject_idx", + ["msgid", "from_complete", "to_complete", "subject"], +); + =head1 RELATIONS =head2 bug_messages @@ -224,8 +255,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-03-27 18:54:20 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5H4wsTVgTSnpnO1XcbvhHA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Dow6t1MS7ldAy6KBMtBWRQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/MessageCorrespondent.pm b/Debbugs/DB/Result/MessageCorrespondent.pm index 0e5840d1..4820e3fe 100644 --- a/Debbugs/DB/Result/MessageCorrespondent.pm +++ b/Debbugs/DB/Result/MessageCorrespondent.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -159,8 +161,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:O+1oiAgBblG5UTsHpF4xRw +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HiQOa7XliOu8PNC8DxQPnQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/MessageRef.pm b/Debbugs/DB/Result/MessageRef.pm index b0355982..eb426524 100644 --- a/Debbugs/DB/Result/MessageRef.pm +++ b/Debbugs/DB/Result/MessageRef.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -155,8 +157,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:27:54 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oEOZLlhxLd5tyH5IW5KhTA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AYCyNKkqOAjoWVelU0HKrA # 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 34366e36..c31b6e6d 100644 --- a/Debbugs/DB/Result/Severity.pm +++ b/Debbugs/DB/Result/Severity.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -139,8 +141,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-23 17:31:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xZN34NjFy5iDRay5w6JYVQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nI4ZqWa6IW7LgWuG7S1Gog # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/SrcAssociation.pm b/Debbugs/DB/Result/SrcAssociation.pm index c160ca18..f35eb166 100644 --- a/Debbugs/DB/Result/SrcAssociation.pm +++ b/Debbugs/DB/Result/SrcAssociation.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -153,8 +155,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-10-09 20:23:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3Hl8VlcLTNPdCLO6kMVyxQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OArdotyolRaEbHj7Yxio2Q # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/SrcPkg.pm b/Debbugs/DB/Result/SrcPkg.pm index 2c9c38ea..b9e80229 100644 --- a/Debbugs/DB/Result/SrcPkg.pm +++ b/Debbugs/DB/Result/SrcPkg.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -176,6 +178,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 bug_affects_srcpackages + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "bug_affects_srcpackages", + "Debbugs::DB::Result::BugAffectsSrcpackage", + { "foreign.src_pkg" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 bug_srcpackages Type: has_many @@ -237,8 +254,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07036 @ 2013-11-13 09:19:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XKxXxExb3rnZZyuA+70mww +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qJt8Dn/9gBxJKauPUCFS7w # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/SrcVer.pm b/Debbugs/DB/Result/SrcVer.pm index 879ebe52..79c39f18 100644 --- a/Debbugs/DB/Result/SrcVer.pm +++ b/Debbugs/DB/Result/SrcVer.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -257,8 +259,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:Pp9Uh44hbBpvnLdssezZ9Q +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gY5LidUaQeuJ5AnN06CfKQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/Suite.pm b/Debbugs/DB/Result/Suite.pm index 2170d6d7..671a99e9 100644 --- a/Debbugs/DB/Result/Suite.pm +++ b/Debbugs/DB/Result/Suite.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -167,8 +169,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:xIVtTLCQc72u8xQOuwQhrQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3csVa5t/HsPdWr0/Nmr7WA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Debbugs/DB/Result/Tag.pm b/Debbugs/DB/Result/Tag.pm index 3bbcccb4..c8d53972 100644 --- a/Debbugs/DB/Result/Tag.pm +++ b/Debbugs/DB/Result/Tag.pm @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -119,8 +121,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:5Xx50RAuyQQ3VpS0ypsFEQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HH2aKSj4xl+co6qffSdrrQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/bin/debbugs-installsql b/bin/debbugs-installsql index 4e19dbe5..71beb8d2 100755 --- a/bin/debbugs-installsql +++ b/bin/debbugs-installsql @@ -81,8 +81,8 @@ my %options = (debug => 0, ); GetOptions(\%options, - 'service|s', - 'sysconfdir|c', + 'service|s=s', + 'sysconfdir|c=s', 'install', 'upgrade', 'current_version|current-version', @@ -135,16 +135,13 @@ if ($options{current_version}) { } elsif ($options{install}) { if ($options{developer_prepare}) { $dh->prepare_install; + $dh->prepare_deploy; } else { $dh->install; } } elsif ($options{upgrade}) { - if ($options{developer_prepare}) { - $dh->prepare_deploy; - $dh->prepare_upgrade; - } else { - $dh->upgrade; - } + $dh->prepare_upgrade; + $dh->upgrade; } diff --git a/sql/dbicdump.conf b/sql/dbicdump.conf index f9c27415..02460b6c 100644 --- a/sql/dbicdump.conf +++ b/sql/dbicdump.conf @@ -3,7 +3,7 @@ schema_class Debbugs::DB::Schema lib . - dsn dbi:Pg:service=snp + dsn dbi:Pg:service=debbugs diff --git a/sql/dbicdump_command.sh b/sql/dbicdump_command.sh index 0ad4b164..6aac4b77 100755 --- a/sql/dbicdump_command.sh +++ b/sql/dbicdump_command.sh @@ -10,7 +10,8 @@ if ! [ -d "sql" ] || ! [ -d "Debbugs" ]; then fi; dbicdump -I. -o dump_directory=. \ - -o components='["InflateColumn::DateTime"]' \ + -o components='["InflateColumn::DateTime","TimeStamp"]' \ -o preserve_case=1 \ + -o exclude='qr/^dbix_class_deploymenthandler_versions$/' \ Debbugs::DB dbi:Pg:service=$DEBBUGS_SERVICE '' ''; diff --git a/sql/debbugs_schema.sql b/sql/debbugs_schema.sql index c3e313ca..af98307b 100644 --- a/sql/debbugs_schema.sql +++ b/sql/debbugs_schema.sql @@ -1,6 +1,6 @@ DROP TABLE bug_status_cache CASCADE; -DROP VIEW bug_package CASCADE; +DROP VIEW bug_package CASCADE; DROP VIEW binary_versions CASCADE; DROP TABLE bug_tag CASCADE; DROP TABLE tag CASCADE; @@ -16,6 +16,8 @@ DROP TABLE bug_blocks CASCADE; DROP TABLE bug_merged CASCADE; DROP TABLE bug_srcpackage CASCADE; DROP TABLE bug_binpackage CASCADE; +DROP TABLE bug_affects_binpackage CASCADE; +DROP TABLE bug_affects_srcpackage CASCADE; DROP TABLE suite CASCADE; DROP TABLE bin_associations CASCADE; DROP TABLE src_associations CASCADE; @@ -34,22 +36,23 @@ DROP TYPE bug_status_type CASCADE; -- the following two tables are used to provide documentation about -- the tables and columns for DBIx::Class::Schema::Loader CREATE TABLE table_comments ( - table_name TEXT UNIQUE NOT NULL, + table_name TEXT NOT NULL, comment_text TEXT NOT NULL ); +CREATE UNIQUE INDEX table_comments_table_name_idx ON table_comments(table_name); CREATE TABLE column_comments ( table_name TEXT NOT NULL, column_name TEXT NOT NULL, comment_text TEXT NOT NULL ); -CREATE UNIQUE INDEX ON column_comments(table_name,column_name); +CREATE UNIQUE INDEX column_comments_table_name_column_name_idx ON column_comments(table_name,column_name); CREATE TABLE correspondent ( id SERIAL PRIMARY KEY, addr TEXT NOT NULL ); -CREATE UNIQUE INDEX ON correspondent(addr); +CREATE UNIQUE INDEX correspondent_addr_idx ON correspondent(addr); INSERT INTO table_comments VALUES ('correspondent','Individual who has corresponded with the BTS'); INSERT INTO column_comments VALUES ('correspondent','id','Correspondent ID'); INSERT INTO column_comments VALUES ('correspondent','addr','Correspondent address'); @@ -61,8 +64,8 @@ CREATE TABLE maintainer ( created TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL, modified TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL ); -CREATE UNIQUE INDEX ON maintainer(name); -CREATE INDEX ON maintainer(correspondent); +CREATE UNIQUE INDEX maintainer_name_idx ON maintainer(name); +CREATE INDEX maintainer_idx_correspondent ON maintainer(correspondent); INSERT INTO table_comments VALUES ('maintainer','Package maintainer names'); INSERT INTO column_comments VALUES ('maintainer','id','Package maintainer id'); INSERT INTO column_comments VALUES ('maintainer','name','Name of package maintainer'); @@ -78,8 +81,8 @@ CREATE TABLE severity ( strong BOOLEAN DEFAULT FALSE, obsolete BOOLEAN DEFAULT FALSE ); -CREATE UNIQUE INDEX ON severity(severity); -CREATE INDEX ON severity(ordering); +CREATE UNIQUE INDEX severity_severity_idx ON severity(severity); +CREATE INDEX severity_ordering_idx ON severity(ordering); INSERT INTO table_comments VALUES ('severity','Bug severity'); INSERT INTO column_comments VALUES ('severity','id','Severity id'); INSERT INTO column_comments VALUES ('severity','severity','Severity name'); @@ -109,12 +112,15 @@ CREATE TABLE bug ( submitter_full TEXT NOT NULL DEFAULT '', unknown_packages TEXT NOT NULL DEfAULT '' ); -CREATE INDEX ON bug(owner); -CREATE INDEX ON bug(submitter); -CREATE INDEX ON bug(done); -CREATE INDEX ON bug(forwarded); -CREATE INDEX ON bug(last_modified); -CREATE INDEX ON bug(severity); +CREATE INDEX bug_idx_owner ON bug(owner); +CREATE INDEX bug_idx_submitter ON bug(submitter); +CREATE INDEX bug_idx_done ON bug(done); +CREATE INDEX bug_idx_forwarded ON bug(forwarded); +CREATE INDEX bug_idx_last_modified ON bug(last_modified); +CREATE INDEX bug_idx_severity ON bug(severity); +CREATE INDEX bug_idx_creation ON bug(creation); +CREATE INDEX bug_idx_log_modified ON bug(log_modified); + INSERT INTO table_comments VALUES ('bug','Bugs'); INSERT INTO column_comments VALUES ('bug','id','Bug number'); INSERT INTO column_comments VALUES ('bug','creation','Time bug created'); @@ -131,13 +137,6 @@ INSERT INTO column_comments VALUES ('bug','owner','Individual who owns this bug; INSERT INTO column_comments VALUES ('bug','submitter','Individual who submitted this bug; empty if there is no submitter'); INSERT INTO column_comments VALUES ('bug','unknown_packages','Package name if the package is not known'); -CREATE INDEX ON bug(creation); -CREATE INDEX ON bug(log_modified); -CREATE INDEX ON bug(done); -CREATE INDEX ON bug(owner); -CREATE INDEX ON bug(submitter); -CREATE INDEX ON bug(forwarded); - CREATE TABLE bug_blocks ( @@ -193,7 +192,7 @@ CREATE TABLE src_ver ( id SERIAL PRIMARY KEY, src_pkg INT NOT NULL REFERENCES src_pkg ON UPDATE CASCADE ON DELETE CASCADE, - ver public.debversion NOT NULL, + ver debversion NOT NULL, maintainer INT REFERENCES maintainer ON UPDATE CASCADE ON DELETE SET NULL, upload_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), @@ -227,7 +226,7 @@ CREATE TABLE bug_ver ( CREATE INDEX bug_ver_src_pkg_id_idx ON bug_ver(src_pkg); 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); +CREATE UNIQUE INDEX bug_ver_bug_ver_string_found_idx 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'); @@ -241,8 +240,9 @@ INSERT INTO column_comments VALUES ('bug_ver','last_modified','Time that this en CREATE TABLE arch ( id SERIAL PRIMARY KEY, - arch TEXT NOT NULL UNIQUE + arch TEXT NOT NULL ); +CREATE UNIQUE INDEX arch_arch_key ON arch(arch); INSERT INTO table_comments VALUES ('arch','Architectures'); INSERT INTO column_comments VALUES ('arch','id','Architecture id'); INSERT INTO column_comments VALUES ('arch','arch','Architecture name'); @@ -250,8 +250,9 @@ INSERT INTO column_comments VALUES ('arch','arch','Architecture name'); CREATE TABLE bin_pkg ( id SERIAL PRIMARY KEY, - pkg TEXT NOT NULL UNIQUE + pkg TEXT NOT NULL ); +CREATE UNIQUE INDEX bin_pkg_pkg_key ON bin_pkg(pkg); INSERT INTO table_comments VALUES ('bin_pkg','Binary packages'); INSERT INTO column_comments VALUES ('bin_pkg','id','Binary package id'); INSERT INTO column_comments VALUES ('bin_pkg','pkg','Binary package name'); @@ -265,11 +266,11 @@ CREATE TABLE bin_ver( ON UPDATE CASCADE ON DELETE CASCADE, arch INT NOT NULL REFERENCES arch ON UPDATE CASCADE ON DELETE CASCADE, - ver public.debversion NOT NULL + ver debversion NOT NULL ); CREATE INDEX bin_ver_ver_idx ON bin_ver(ver); -CREATE UNIQUE INDEX bin_ver_bin_pkg_id_arch_idx ON bin_ver(bin_pkg,arch_id,ver); -CREATE UNIQUE INDEX bin_ver_src_ver_id_arch_idx ON bin_ver(src_ver_id,arch); +CREATE UNIQUE INDEX bin_ver_bin_pkg_id_arch_idx ON bin_ver(bin_pkg,arch,ver); +CREATE UNIQUE INDEX bin_ver_src_ver_id_arch_idx ON bin_ver(src_ver,arch); CREATE INDEX bin_ver_bin_pkg_id_idx ON bin_ver(bin_pkg); CREATE INDEX bin_ver_src_ver_id_idx ON bin_ver(src_ver); INSERT INTO table_comments VALUES ('bin_ver','Binary versions'); @@ -320,6 +321,9 @@ CREATE TABLE bug_srcpackage ( 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'); INSERT INTO column_comments VALUES ('bug_srcpackage','bug','Bug id (matches bug)'); INSERT INTO column_comments VALUES ('bug_srcpackage','src_pkg','Source package id (matches src_pkg)'); @@ -360,12 +364,13 @@ CREATE VIEW binary_versions (src_pkg, src_ver, bin_pkg, arch, bin_ver) AS CREATE TABLE suite ( id SERIAL PRIMARY KEY, - suite_name TEXT NOT NULL UNIQUE, + suite_name TEXT NOT NULL, version TEXT, codename TEXT, active BOOLEAN DEFAULT TRUE); -CREATE INDEX ON suite(codename); -CREATE INDEX ON suite(version); +CREATE UNIQUE INDEX suite_suite_name_key ON suite(suite_name); +CREATE INDEX suite_idx_codename ON suite(codename); +CREATE INDEX suite_idx_version ON suite(version); INSERT INTO table_comments VALUES ('suite','Debian Release Suite (stable, testing, etc.)'); INSERT INTO column_comments VALUES ('suite','id','Suite id'); INSERT INTO column_comments VALUES ('suite','suite_name','Suite name'); @@ -413,9 +418,11 @@ CREATE TABLE bug_status_cache ( modified TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL, asof TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL ); -CREATE UNIQUE INDEX ON bug_status_cache(bug,suite,arch); -CREATE INDEX ON bug_status_cache(bug); -CREATE INDEX ON bug_status_cache(status); +CREATE UNIQUE INDEX bug_status_cache_bug_suite_arch_idx ON bug_status_cache(bug,suite,arch); +CREATE INDEX bug_status_cache_idx_bug ON bug_status_cache(bug); +CREATE INDEX bug_status_cache_idx_status ON bug_status_cache(status); +CREATE INDEX bug_status_cache_idx_arch ON bug_status_cache(arch); +CREATE INDEX bug_status_cache_idx_suite ON bug_status_cache(suite); INSERT INTO table_comments VALUES ('bug_status_cache','Source <-> suite associations'); INSERT INTO column_comments VALUES ('bug_status_cache','id','Source <-> suite association id'); INSERT INTO column_comments VALUES ('bug_status_cache','bug','Source <-> suite association id'); @@ -429,16 +436,16 @@ INSERT INTO column_comments VALUES ('bug_status_cache','asof','Source <-> suite CREATE TABLE message ( id SERIAL PRIMARY KEY, - msgid TEXT, - from_complete TEXT, - from_addr TEXT, - to_complete TEXT, - to_addr TEXT, + 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 '', - spam_score FLOAT, - is_spam BOOLEAN DEFAULT FALSE + spam_score FLOAT NOT NULL DEFAULT 0, + is_spam BOOLEAN NOT NULL DEFAULT FALSE ); INSERT INTO table_comments VALUES ('message','Messages sent to bugs'); INSERT INTO column_comments VALUES ('message','id','Message id'); @@ -452,7 +459,10 @@ 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 INDEX message_msgid_idx ON message(msgid); +CREATE UNIQUE INDEX message_msgid_from_complete_to_complete_subject_idx + ON message(msgid,from_complete,to_complete,subject); +CREATE INDEX message_subject_idx ON message(subject); CREATE TABLE message_refs ( id SERIAL PRIMARY KEY, @@ -462,9 +472,9 @@ CREATE TABLE message_refs ( primary_ref BOOLEAN DEFAULT FALSE, CONSTRAINT message_doesnt_reference_itself CHECK (message <> refs) ); -CREATE UNIQUE INDEX ON message_refs(message,refs); -CREATE INDEX ON message_refs(refs); -CREATE INDEX ON message_refs(message); +CREATE UNIQUE INDEX message_refs_message_refs_idx ON message_refs(message,refs); +CREATE INDEX message_refs_idx_refs ON message_refs(refs); +CREATE INDEX message_refs_idx_message ON message_refs(message); INSERT INTO table_comments VALUES ('message_refs','Message references'); INSERT INTO column_comments VALUES ('message_refs','message','Message id (matches message)'); INSERT INTO column_comments VALUES ('message_refs','refs','Reference id (matches message)'); @@ -479,9 +489,10 @@ CREATE TABLE correspondent_full_name( full_name TEXT NOT NULL, last_seen TIMESTAMP NOT NULL DEFAULT NOW() ); -CREATE UNIQUE INDEX ON correspondent_full_name(correspondent,full_name); -CREATE INDEX ON correspondent_full_name(full_name); -CREATE INDEX ON correspondent_full_name(last_seen); +CREATE UNIQUE INDEX correspondent_full_name_correspondent_full_name_idx + ON correspondent_full_name(correspondent,full_name); +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)'); @@ -500,9 +511,10 @@ INSERT INTO column_comments VALUES ('message_correspondent','message','Message i INSERT INTO column_comments VALUES ('message_correspondent','correspondent','Correspondent (matches correspondent)'); INSERT INTO column_comments VALUES ('message_correspondent','correspondent_type','Type of correspondent (to, from, envfrom, cc, etc.)'); -CREATE UNIQUE INDEX ON message_correspondent(message,correspondent,correspondent_type); -CREATE INDEX ON message_correspondent(correspondent); -CREATE INDEX ON message_correspondent(message); +CREATE UNIQUE INDEX message_correspondent_message_correspondent_correspondent_t_idx + ON message_correspondent(message,correspondent,correspondent_type); +CREATE INDEX message_correspondent_idx_correspondent ON message_correspondent(correspondent); +CREATE INDEX message_correspondent_idx_message ON message_correspondent(message); CREATE TABLE bug_message ( id SERIAL PRIMARY KEY, @@ -512,8 +524,8 @@ CREATE TABLE bug_message ( bug_log_offset INT, offset_valid TIMESTAMP WITH TIME ZONE ); -CREATE UNIQUE INDEX ON bug_message(bug,message); -CREATE INDEX ON bug_message(bug,message_number); +CREATE UNIQUE INDEX bug_message_bug_message_idx ON bug_message(bug,message); +CREATE INDEX bug_message_idx_bug_message_number ON 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.5