Bug 526980

Summary: checksetup.pl error when trying to add column profiles.password_last_changed
Product: [Community] Bugzilla Reporter: David Lawrence <dkl>
Component: DatabaseAssignee: Tony Fu <tfu>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 3.4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-10-19 07:03:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 520523    

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.