]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 451735: Wrong index for the series table
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 13 Oct 2010 23:16:38 +0000 (01:16 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 13 Oct 2010 23:16:38 +0000 (01:16 +0200)
r/a=mkanat

Bugzilla/DB/Schema.pm
Bugzilla/Install/DB.pm

index c8adde17f3141c900f235f05cefd7045272c3d1e..a64aa04a25c5b550d779f329d6bd026e756d44a5 100644 (file)
@@ -1304,9 +1304,9 @@ use constant ABSTRACT_SCHEMA => {
                             DEFAULT => 'FALSE'},
         ],
         INDEXES => [
-            series_creator_idx  =>
-                {FIELDS => [qw(creator category subcategory name)],
-                 TYPE => 'UNIQUE'},
+            series_creator_idx  => ['creator'],
+            series_category_idx => {FIELDS => [qw(category subcategory name)],
+                                    TYPE => 'UNIQUE'},
         ],
     },
 
index b6e58b857fce690897498e6a314f121f1ce017ce..f8a9c15d3bb97dd693aca9787ef865ebc817da72 100644 (file)
@@ -637,6 +637,9 @@ sub update_table_definitions {
     # 2010-10-09 LpSolit@gmail.com - Bug 505165
     $dbh->bz_alter_column('flags', 'setter_id', {TYPE => 'INT3', NOTNULL => 1});
 
+    # 2010-10-09 LpSolit@gmail.com - Bug 451735
+    _fix_series_indexes();
+
     ################################################################
     # New --TABLE-- changes should go *** A B O V E *** this point #
     ################################################################
@@ -3450,6 +3453,16 @@ sub _migrate_field_visibility_value {
     }
 }
 
+sub _fix_series_indexes {
+    my $dbh = Bugzilla->dbh;
+    return if $dbh->bz_index_info('series', 'series_category_idx');
+
+    $dbh->bz_drop_index('series', 'series_creator_idx');
+    $dbh->bz_add_index('series', 'series_creator_idx', ['creator']);
+    $dbh->bz_add_index('series', 'series_category_idx',
+        {FIELDS => [qw(category subcategory name)], TYPE => 'UNIQUE'});
+}
+
 1;
 
 __END__