diff options
author | mkanat%bugzilla.org <> | 2009-09-22 01:49:18 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-09-22 01:49:18 +0200 |
commit | da1e0f0e5d9e3d2659fb9bb137a340481d88cbcb (patch) | |
tree | ce72bfa3bbb3ca569d32237f29e05d3db8203619 /Bugzilla/Install | |
parent | be1c97006f52e07419aa1d17cdc25ac0a835441a (diff) | |
download | bugzilla-da1e0f0e5d9e3d2659fb9bb137a340481d88cbcb.tar.gz bugzilla-da1e0f0e5d9e3d2659fb9bb137a340481d88cbcb.tar.xz |
Bug 516712: Allow checksetup.pl to upgrade installations from before 3.4 where profiles.extern_id contains multiple empty string values.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r-- | Bugzilla/Install/DB.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index d39d1a770..99e5b9895 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -559,8 +559,7 @@ sub update_table_definitions { _add_visiblity_value_to_value_tables(); # 2009-03-02 arbingersys@gmail.com - Bug 423613 - $dbh->bz_add_index('profiles', 'profiles_extern_id_idx', - {TYPE => 'UNIQUE', FIELDS => [qw(extern_id)]}); + _add_extern_id_index(); # 2009-03-31 LpSolit@gmail.com - Bug 478972 $dbh->bz_alter_column('group_control_map', 'entry', @@ -3180,6 +3179,17 @@ sub _add_visiblity_value_to_value_tables { } } +sub _add_extern_id_index { + my $dbh = Bugzilla->dbh; + if (!$dbh->bz_index_info('profiles', 'profiles_extern_id_idx')) { + # Some Bugzillas have a multiple empty strings in extern_id, + # which need to be converted to NULLs before we add the index. + $dbh->do("UPDATE profiles SET extern_id = NULL WHERE extern_id = ''"); + $dbh->bz_add_index('profiles', 'profiles_extern_id_idx', + {TYPE => 'UNIQUE', FIELDS => [qw(extern_id)]}); + } +} + sub _convert_disallownew_to_isactive { my $dbh = Bugzilla->dbh; if ($dbh->bz_column_info('products', 'disallownew')){ |