Bug 526980 - checksetup.pl error when trying to add column profiles.password_last_changed
Summary: checksetup.pl error when trying to add column profiles.password_last_changed
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Bugzilla
Classification: Community
Component: Database
Version: 3.4
Hardware: All
OS: Linux
low
medium vote
Target Milestone: ---
Assignee: Tony Fu
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 520523
TreeView+ depends on / blocked
 
Reported: 2009-10-02 20:26 UTC by David Lawrence
Modified: 2013-06-24 04:06 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-10-19 07:03:07 UTC


Attachments (Terms of Use)

Description David Lawrence 2009-10-02 20:26:02 UTC
Description of problem:
When running checksetup.pl on a 3.2 database to convert to 3.4 with live data the following error is generated:

Adding new column 'password_last_changed' to the 'profiles' table...
DBD::mysql::db do failed: Duplicate column name 'password_last_changed' [for Statement "ALTER TABLE profiles ADD COLUMN password_last_changed datetime"] at Bugzilla/DB.pm line 498
	Bugzilla::DB::bz_add_column('Bugzilla::DB::Mysql=HASH(0x1cbd0000)', 'profiles', 'password_last_changed', 'HASH(0x1fe11c90)') called at Bugzilla/Install/DB.pm line 564
	Bugzilla::Install::DB::update_table_definitions('HASH(0x19996170)') called at ./checksetup.pl line 192

This comes from the fact that the column was not added properly using Bugzilla->dbh->bz_add_column() instead was added via direct CREATE TABLE SQL.

Need to figure out how to make add this column to the bz schema table without dropping and readding, which will loose the current data for that column.

Dave

Comment 1 David Lawrence 2009-10-02 21:39:34 UTC
I think I found a workaround for this. We just need to fool checksetup.pl to think that the column is in the schema stored in the bugzilla schema table. So we can call the internal Bugzilla::DB::Schema and Bugzilla::DB functions.

Bugzilla->dbh->_bz_real_schema->set_column('profiles', 'password_last_changed', { TYPE => 'DATETIME' });
Bugzilla->dbh->_bz_store_real_schema;

Then when checksetup runs it will see that the column is already there and will not generate the SQL error.

Maybe...will test

Comment 2 Tony Fu 2009-10-19 07:03:07 UTC
Have run a script to update bz_schema on production bugzilla db.

This bug should have been fixed.


Note You need to log in before you can comment on or make changes to this bug.