diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php index 741ab66531..0d35f83921 100755 --- a/phpgwapi/setup/setup.inc.php +++ b/phpgwapi/setup/setup.inc.php @@ -14,7 +14,7 @@ /* Basic information about this app */ $setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'eGroupWare API'; - $setup_info['phpgwapi']['version'] = '1.3.010'; + $setup_info['phpgwapi']['version'] = '1.3.011'; $setup_info['phpgwapi']['versions']['current_header'] = '1.28'; $setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['app_order'] = 1; @@ -70,3 +70,4 @@ + diff --git a/phpgwapi/setup/tables_current.inc.php b/phpgwapi/setup/tables_current.inc.php index 5115a8a28c..775626711e 100644 --- a/phpgwapi/setup/tables_current.inc.php +++ b/phpgwapi/setup/tables_current.inc.php @@ -549,12 +549,12 @@ 'contact_modified' => array('type' => 'int','precision' => '8','nullable' => False), 'contact_modifier' => array('type' => 'int','precision' => '4'), 'contact_jpegphoto' => array('type' => 'blob'), - 'account_id' => array('type' => 'int','precision' => '4','default' => '0') + 'account_id' => array('type' => 'int','precision' => '4') ), 'pk' => array('contact_id'), 'fk' => array(), 'ix' => array('contact_owner','cat_id','n_fileas',array('n_family','n_given'),array('n_given','n_family'),array('org_name','n_family','n_given')), - 'uc' => array() + 'uc' => array('account_id') ), 'egw_addressbook_extra' => array( 'fd' => array( diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index 498ca224a0..ccf1969c06 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -573,4 +573,20 @@ return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.3.010'; } + + + $test[] = '1.3.010'; + function phpgwapi_upgrade1_3_010() + { + // account_id should be unique, the (unique) index also speed up the joins with the account-table + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook','account_id',array( + 'type' => 'int', + 'precision' => '4' + )); + $GLOBALS['egw_setup']->db->query('UPDATE egw_addressbook SET account_id=NULL WHERE account_id=0',__LINE__,__FILE__); + + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook',array('account_id'),true); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.3.011'; + } ?>