]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 776982 - Increase longdescs primary key size to INTSERIAL for future growth
authorDave Lawrence <dlawrence@mozilla.com>
Tue, 31 Jul 2012 15:31:06 +0000 (11:31 -0400)
committerDave Lawrence <dlawrence@mozilla.com>
Tue, 31 Jul 2012 15:31:06 +0000 (11:31 -0400)
r/a=LpSolit

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

index a4bd40cbb3ef92c94b6e4aa25a11d2dcb4b4979e..3330c846ae5554136fd91dd791a6138ff0ac93e9 100644 (file)
@@ -341,7 +341,7 @@ use constant ABSTRACT_SCHEMA => {
                                              COLUMN =>  'id'}},
             added     => {TYPE => 'varchar(255)'},
             removed   => {TYPE => 'varchar(255)'},
-            comment_id => {TYPE => 'INT3', 
+            comment_id => {TYPE => 'INT4', 
                            REFERENCES => { TABLE  => 'longdescs',
                                            COLUMN => 'comment_id',
                                            DELETE => 'CASCADE'}},
@@ -376,7 +376,7 @@ use constant ABSTRACT_SCHEMA => {
 
     longdescs => {
         FIELDS => [
-            comment_id      => {TYPE => 'MEDIUMSERIAL',  NOTNULL => 1,
+            comment_id      => {TYPE => 'INTSERIAL',  NOTNULL => 1,
                                 PRIMARYKEY => 1},
             bug_id          => {TYPE => 'INT3',  NOTNULL => 1,
                                 REFERENCES => {TABLE => 'bugs',
index 382a50e5093c2318622c1e0b72db831413231515..31c8da71c38b096201a66e8731cbef2197a8a2a9 100644 (file)
@@ -440,7 +440,7 @@ sub update_table_definitions {
     
     # 2005-12-07 altlst@sonic.net -- Bug 225221
     $dbh->bz_add_column('longdescs', 'comment_id',
-        {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
+        {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
 
     _stop_storing_inactive_flags();
     _change_short_desc_from_mediumtext_to_varchar();
@@ -592,7 +592,7 @@ sub update_table_definitions {
     _fix_series_creator_fk();
 
     # 2009-11-14 dkl@redhat.com - Bug 310450
-    $dbh->bz_add_column('bugs_activity', 'comment_id', {TYPE => 'INT3'});
+    $dbh->bz_add_column('bugs_activity', 'comment_id', {TYPE => 'INT4'});
 
     # 2010-04-07 LpSolit@gmail.com - Bug 69621
     $dbh->bz_drop_column('bugs', 'keywords');
@@ -691,6 +691,9 @@ sub update_table_definitions {
                           {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
 
 
+    # 2012-07-24 dkl@mozilla.com - Bug 776982
+    _fix_longdescs_primary_key();
+
     ################################################################
     # New --TABLE-- changes should go *** A B O V E *** this point #
     ################################################################
@@ -3712,6 +3715,16 @@ sub _fix_notnull_defaults {
     }
 }
 
+sub _fix_longdescs_primary_key {
+    my $dbh = Bugzilla->dbh;
+    if ($dbh->bz_column_info('longdescs', 'comment_id')->{TYPE} ne 'INTSERIAL') {
+        $dbh->bz_drop_related_fks('longdescs', 'comment_id');
+        $dbh->bz_alter_column('bugs_activity', 'comment_id', {TYPE => 'INT4'});
+        $dbh->bz_alter_column('longdescs', 'comment_id',
+                              {TYPE => 'INTSERIAL',  NOTNULL => 1,  PRIMARYKEY => 1});
+    }
+}
+
 1;
 
 __END__