fix SQL error on 14.1 update: Unknown column account_description

This commit is contained in:
Ralf Becker 2015-09-15 08:19:21 +00:00
parent 4757b67af0
commit ec6d16b7e6

View File

@ -53,6 +53,13 @@ function phpgwapi_upgrade14_1()
*/ */
function phpgwapi_upgrade14_1_900() function phpgwapi_upgrade14_1_900()
{ {
// running 14.2 update, as add_account will write account_description and gives SQL error if it does not exist
$GLOBALS['egw_setup']->oProc->AddColumn('egw_accounts','account_description',array(
'type' => 'varchar',
'precision' => '255',
'comment' => 'group description'
));
// Create anonymous user for sharing of files // Create anonymous user for sharing of files
$GLOBALS['egw_setup']->add_account('NoGroup', 'No', 'Rights', false, false); $GLOBALS['egw_setup']->add_account('NoGroup', 'No', 'Rights', false, false);
$anonymous = $GLOBALS['egw_setup']->add_account('anonymous', 'SiteMgr', 'User', 'anonymous', 'NoGroup'); $anonymous = $GLOBALS['egw_setup']->add_account('anonymous', 'SiteMgr', 'User', 'anonymous', 'NoGroup');
@ -62,12 +69,16 @@ function phpgwapi_upgrade14_1_900()
} }
function phpgwapi_upgrade14_2() function phpgwapi_upgrade14_2()
{ {
$GLOBALS['egw_setup']->oProc->AddColumn('egw_accounts','account_description',array( // check if egw_accounts.account_description already exists, as it might have been created by above upgrade
'type' => 'varchar', $meta = $GLOBALS['egw_setup']->db->metadata('egw_accounts', true);
'precision' => '255', if (!isset($meta['meta']['account_description']))
'comment' => 'group description' {
)); $GLOBALS['egw_setup']->oProc->AddColumn('egw_accounts','account_description',array(
'type' => 'varchar',
'precision' => '255',
'comment' => 'group description'
));
}
return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '14.2.001'; return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '14.2.001';
} }