]> git.donarmstrong.com Git - debbugs.git/commitdiff
handle affects properly and upgrade schema
authorDon Armstrong <don@donarmstrong.com>
Sun, 28 Feb 2016 22:58:10 +0000 (14:58 -0800)
committerDon Armstrong <don@donarmstrong.com>
Wed, 10 Aug 2016 20:45:41 +0000 (13:45 -0700)
31 files changed:
Debbugs/DB/Result/Arch.pm
Debbugs/DB/Result/BinAssociation.pm
Debbugs/DB/Result/BinPkg.pm
Debbugs/DB/Result/BinVer.pm
Debbugs/DB/Result/BinaryVersion.pm
Debbugs/DB/Result/Bug.pm
Debbugs/DB/Result/BugBinpackage.pm
Debbugs/DB/Result/BugBlock.pm
Debbugs/DB/Result/BugMerged.pm
Debbugs/DB/Result/BugMessage.pm
Debbugs/DB/Result/BugPackage.pm
Debbugs/DB/Result/BugSrcpackage.pm
Debbugs/DB/Result/BugStatusCache.pm
Debbugs/DB/Result/BugTag.pm
Debbugs/DB/Result/BugVer.pm
Debbugs/DB/Result/Correspondent.pm
Debbugs/DB/Result/CorrespondentFullName.pm
Debbugs/DB/Result/Maintainer.pm
Debbugs/DB/Result/Message.pm
Debbugs/DB/Result/MessageCorrespondent.pm
Debbugs/DB/Result/MessageRef.pm
Debbugs/DB/Result/Severity.pm
Debbugs/DB/Result/SrcAssociation.pm
Debbugs/DB/Result/SrcPkg.pm
Debbugs/DB/Result/SrcVer.pm
Debbugs/DB/Result/Suite.pm
Debbugs/DB/Result/Tag.pm
bin/debbugs-installsql
sql/dbicdump.conf
sql/dbicdump_command.sh
sql/debbugs_schema.sql

index 854111c8a82b40db05c6f6a232c1f47b04f8a2d0..3045047552622433b1a5470c51addb08c5b9e62b 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<arch>
 
@@ -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
index 7f32065d773a96a8bd363fc7f4b239d7e0e8a87e..02d923ef14041eb41455f85400e356b6b5521120 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bin_associations>
 
@@ -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
index 861c7660aa56a92062e3913128c8df00b47929af..5747fe084718f1a26eac32398a52c9b162279465 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bin_pkg>
 
@@ -108,6 +110,21 @@ __PACKAGE__->has_many(
   { cascade_copy => 0, cascade_delete => 0 },
 );
 
+=head2 bug_affects_binpackages
+
+Type: has_many
+
+Related object: L<Debbugs::DB::Result::BugAffectsBinpackage>
+
+=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
index fc7ce46fed4106711814c4d4a20fc91c5c9121e3..7a71c0910e9a5e8d99ae938652874b70cf76d5f3 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bin_ver>
 
@@ -107,6 +109,38 @@ __PACKAGE__->add_columns(
 
 __PACKAGE__->set_primary_key("id");
 
+=head1 UNIQUE CONSTRAINTS
+
+=head2 C<bin_ver_bin_pkg_id_arch_idx>
+
+=over 4
+
+=item * L</bin_pkg>
+
+=item * L</arch>
+
+=item * L</ver>
+
+=back
+
+=cut
+
+__PACKAGE__->add_unique_constraint("bin_ver_bin_pkg_id_arch_idx", ["bin_pkg", "arch", "ver"]);
+
+=head2 C<bin_ver_src_ver_id_arch_idx>
+
+=over 4
+
+=item * L</src_ver>
+
+=item * L</arch>
+
+=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
index a959c82630d0d2b903d06a9a97d022830645471e..57f6b5f1154f80b69f6f90926dbd3954386b4a67 100644 (file)
@@ -21,11 +21,14 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
+__PACKAGE__->table_class("DBIx::Class::ResultSource::View");
 
 =head1 TABLE: C<binary_versions>
 
@@ -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(<<EOF);
+SELECT sp.pkg AS src_pkg, sv.ver AS src_ver, bp.pkg AS bin_pkg, a.arch AS arch, b.ver AS bin_ver,
+svb.ver AS src_ver_based_on, spb.pkg AS src_pkg_based_on
+FROM bin_ver b JOIN arch a ON b.arch = a.id
+                     JOIN bin_pkg bp ON b.bin_pkg  = bp.id
+               JOIN src_ver sv ON b.src_ver  = sv.id
+               JOIN src_pkg sp ON sv.src_pkg = sp.id
+               LEFT OUTER JOIN src_ver svb ON sv.based_on = svb.id
+               LEFT OUTER JOIN src_pkg spb ON spb.id = svb.src_pkg;
+EOF
 
 # You can replace this text with custom code or comments, and it will be preserved on regeneration
 1;
index ab08d49b7c907ac21926d143a1e5b754e4e6d968..555c2d7d7961cf8c19efe573eb17d25e167ef15b 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug>
 
@@ -241,6 +243,36 @@ __PACKAGE__->set_primary_key("id");
 
 =head1 RELATIONS
 
+=head2 bug_affects_binpackages
+
+Type: has_many
+
+Related object: L<Debbugs::DB::Result::BugAffectsBinpackage>
+
+=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<Debbugs::DB::Result::BugAffectsSrcpackage>
+
+=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;
index 30e7eb1780152082b190c7eb4d0bf3fd0b22c968..63223df86af138c8db0ec45bace36859ba79ace9 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_binpackage>
 
@@ -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
index b175f23bd4369eaa7d4b4ff3ab4aae004bbc5a7d..467ab6846db7496e4e3a13c40ea869368083096b 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_blocks>
 
@@ -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
index 324352805dedd60243f47d04d0781134b41defb1..405b44823ac5b715b8c0d18386e6be04fb71200b 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_merged>
 
@@ -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
index d5587da87f8dbb1317e66bd85eaa38833a13043c..b2aa87cae9b9c5af40df05d2e3688b43dfcfca02 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_message>
 
@@ -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
index 5ef0b8abaf987d735a8f7be12e1d057c479f452e..b3d40b88a7021eb66f96959a40ed2970c529e2ca 100644 (file)
@@ -21,11 +21,14 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
+__PACKAGE__->table_class("DBIx::Class::ResultSource::View");
 
 =head1 TABLE: C<bug_package>
 
@@ -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(<<EOF);
+SELECT b.bug,b.bin_pkg,'binary',bp.pkg FROM bug_binpackage b JOIN bin_pkg bp ON bp.id=b.bin_pkg UNION
+       SELECT s.bug,s.src_pkg,'source',sp.pkg FROM bug_srcpackage s JOIN src_pkg sp ON sp.id=s.src_pkg;
+EOF
 
 
 # You can replace this text with custom code or comments, and it will be preserved on regeneration
index dd69194b748e45e9ce117175ea2eeb248516d257..eb24a5a3825aef43e7f7cf3522efa42eccd8b863 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_srcpackage>
 
@@ -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
index 94e29fa1c52a828da0eaefc6280a3666e7146f1b..8aab04d33020116c20cb85e0c18cefec21d9d698 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_status_cache>
 
@@ -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
index 53f0d94e0e318efd9efd671777e92d7f3c33d0da..625f445d0ca0c8ee6f510c428320da649d0ff4f0 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_tag>
 
@@ -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
index 124d185e60bfae96af7f964db6d36527a79e869a..3de7f4cf32b0ee7f2ccfa4f4373d44c11742f16f 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<bug_ver>
 
@@ -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
index 2bf83f93f0496b2000251485c142d2a470c020bb..68ed39d961dbe8f55efbc6c4e82f5081eb0645c9 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<correspondent>
 
@@ -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
index cce140a982e095e900b167e7bcc6e86293848440..d4f73b097c6a26083d06927ae6ffc2d650639377 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<correspondent_full_name>
 
@@ -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
index a15e55cca923d1d0ddf10acdde4bbeda1b59e038..9157653cc6f320ab3cdf7b930737b9d6537db9b1 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<maintainer>
 
@@ -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
index ef36a9e9cceeb7c5132a14e3c7ef3557329199ec..bc493f1396b55e3afe02216175e0e6ce1063df2a 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<message>
 
@@ -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<message_msgid_from_complete_to_complete_subject_idx>
+
+=over 4
+
+=item * L</msgid>
+
+=item * L</from_complete>
+
+=item * L</to_complete>
+
+=item * L</subject>
+
+=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
index 0e5840d136266d22fdb1192527e73a105628ded7..4820e3fe3dec25ebe9a7846d8772a9f529ba38b6 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<message_correspondent>
 
@@ -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
index b035598298ac84b7942ed485959e488098f4bbd3..eb42652418746a5e32fa407564d2618fa7673a3e 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<message_refs>
 
@@ -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
index 34366e36c32eee34693bfdb1de1bf1f7eec60209..c31b6e6d175b198492218aa93c1251e9444c0218 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<severity>
 
@@ -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
index c160ca18f561b709b47f7ace80a3a39255d41598..f35eb1661dfdc90af5716e82f9a1769455e49745 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<src_associations>
 
@@ -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
index 2c9c38ea067c15e02525b4640bb87102b6675118..b9e80229e64586da72cdd1c4c52b8f7a2f1824e9 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<src_pkg>
 
@@ -176,6 +178,21 @@ __PACKAGE__->belongs_to(
   },
 );
 
+=head2 bug_affects_srcpackages
+
+Type: has_many
+
+Related object: L<Debbugs::DB::Result::BugAffectsSrcpackage>
+
+=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
index 879ebe52880dd086852be2b952da55b456198141..79c39f182c95ea78b9e6ebf0d990010b6714b48a 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<src_ver>
 
@@ -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
index 2170d6d7fbc08246a13cec875c94729385949be4..671a99e9c14575591e117ad4fb401e5992f998b2 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<suite>
 
@@ -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
index 3bbcccb47c60f5022612ec72a6231ae7fae0e767..c8d539720f5def626952d0e0fe78418fafa0f5c4 100644 (file)
@@ -21,11 +21,13 @@ use base 'DBIx::Class::Core';
 
 =item * L<DBIx::Class::InflateColumn::DateTime>
 
+=item * L<DBIx::Class::TimeStamp>
+
 =back
 
 =cut
 
-__PACKAGE__->load_components("InflateColumn::DateTime");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
 
 =head1 TABLE: C<tag>
 
@@ -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
index 4e19dbe507b21e94db4824848ad1eccae9f5ff1f..71beb8d2741a20cd8c06ef16fbccc16483274d66 100755 (executable)
@@ -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;
 }
 
 
index f9c2741581994c22afd0cc6827abed278ad837ba..02460b6ca7ee4320bc047770b016b9c12b2d2026 100644 (file)
@@ -3,7 +3,7 @@ schema_class Debbugs::DB::Schema
 lib .
 
 <connect_info>
-    dsn     dbi:Pg:service=snp
+    dsn     dbi:Pg:service=debbugs
 </connect_info>
 
 <loader_options>
index 0ad4b16425c680a247c658a60ae1ee4604b9102d..6aac4b775d0859766bc7a24644cca4c552e03797 100755 (executable)
@@ -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 '' '';
 
index c3e313ca532ced6adc1d42fe3630647a5d6ee747..af98307b7d85959dba2131c894a941175c53a0cd 100644 (file)
@@ -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)');