From c8b717d23600fb680772c11642030056b00cb28b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 11 Sep 2015 08:05:32 +0000 Subject: [PATCH] fix SQL error on 14.1 update: Unknown column account_description --- phpgwapi/setup/tables_update.inc.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index 4759379620..08d285fc54 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -53,6 +53,13 @@ function phpgwapi_upgrade14_1() */ 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 $GLOBALS['egw_setup']->add_account('NoGroup', 'No', 'Rights', false, false); $anonymous = $GLOBALS['egw_setup']->add_account('anonymous', 'SiteMgr', 'User', 'anonymous', 'NoGroup'); @@ -63,12 +70,16 @@ function phpgwapi_upgrade14_1_900() function phpgwapi_upgrade14_2() { - $GLOBALS['egw_setup']->oProc->AddColumn('egw_accounts','account_description',array( - 'type' => 'varchar', - 'precision' => '255', - 'comment' => 'group description' - )); - + // check if egw_accounts.account_description already exists, as it might have been created by above upgrade + $meta = $GLOBALS['egw_setup']->db->metadata('egw_accounts', true); + if (!isset($meta['meta']['account_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'; }