Fail to upgrade Bugzilla from 3.6 to 4.4
Asked Answered
S

2

6

I have Bugzilla installed for several years without upgrading. The version I am using is 3.6.12. Today I try to upgrade it to the latest release 4.4 but fail. I follow the instructions to upgrade Bugzilla using bzr. When I run checksetup.pl, it gives me this:

Updating column setter_id in table flags ...

Old: mediumint

New: mediumint NOT NULL

Updating column setter_id in table flags ...
Old: mediumint
New: mediumint NOT NULL

DBD::mysql::db do failed: Cannot change column 'setter_id': used in a foreign key constraint 'fk_flags_setter_id_profiles_userid' [for Statement "ALTER TABLE flags CHANGE COLUMN setter_id setter_id mediumint NOT NULL"] at Bugzilla/DB.pm line 710.

Bugzilla::DB::bz_alter_column_raw('Bugzilla::DB::Mysql=HASH(0x8663790)', 'flags', 'setter_id', 'HASH(0xc9c8cd8)', 'HASH(0xc9c8ff0)', undef) called at Bugzilla/DB.pm line 669

Bugzilla::DB::bz_alter_column('Bugzilla::DB::Mysql=HASH(0x8663790)', 'flags', 'setter_id', 'HASH(0xc9c8cd8)') called at Bugzilla/Install/DB.pm line 627

Bugzilla::Install::DB::update_table_definitions('HASH(0x3050880)') called at C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\Bugzilla-bzr\checksetup.pl line 169

I am not good at Perl and database. I do not know what does it mean. Can anyone give me a hand? Thank you in advance.

Sunbathe answered 31/5, 2013 at 19:19 Comment(0)
M
3

From https://groups.google.com/forum/#!topic/mozilla.support.bugzilla/w7nqD89cBaQ. You may drop table flags (I have this table empty) and recreate it without foreign key constraint, run checksetup.pl and recreate constraint by command:

alter table flags add CONSTRAINT `fk_flags_setter_id_profiles_userid`FOREIGN KEY (`setter_id`)
REFERENCES `profiles` (`userid`) ON UPDATE CASCADE;

Or edit file DB.pm and add a command SET foreign_key_checks = 0 a line immediately following the line

$dbh = Bugzilla->dbh 
$dbh->do('SET foreign_key_checks = 0');

So I used another way. I modified my dump of and change setter_id column to NOT NULL column. Line

  `setter_id` mediumint(9) DEFAULT NULL,

to

  `setter_id` mediumint(9) NOT NULL,

Here are the SQL commands to run once connected to the bugzilla database:

SET foreign_key_checks = 0;
ALTER TABLE flags MODIFY setter_id mediumint(9) NOT NULL;
SET foreign_key_checks = 1;

Then run checksetup.pl

Mymya answered 26/2, 2015 at 8:44 Comment(1)
I also encountered this issue upgrading from Bugzilla 3.6 to 5.0. Per Arci's suggestion, my solution was to manually edit the flags table and change setter_id to NOT NULL. I did not get any errors saving this change to the table. (I am using the HeidiSQL GUI to make this change). I then ran Bugzilla checksetup.pl again and did not encounter the error.Dilks
L
-1

Have you thought of asking the guys who make it? The most likely reason is that at some point between your current version and the version you wish to install there was a non incremental update. In other words you can't make the leap from your version to the new one without first installing at least one of the required intermediate versions. Info on this should be available from the developers.

Limonene answered 31/5, 2013 at 19:19 Comment(3)
From the instruction of Bugzilla download page, it is said that you can upgrade directly from any old Bugzilla version to any new release--you do not have to upgrade to the releases in between. I try the upgrading again. This time I try to upgrade from 3.6.12 to 4.0.9. I got the same error.Sunbathe
As previously mentioned, this is the sort of thing you would best be served dealing with Bugzilla directly. Using general forums to ask questions about very specific scenarios is never going to be very helpful.Limonene
I updated Bugzilla from version 3.6 to 4.4 and I got this error too. I found solution, so I wrote it here.Mymya

© 2022 - 2024 — McMap. All rights reserved.