make egw_addressbook.account_id unique, as it should be and to speed up the join with the accounts-table

This commit is contained in:
Ralf Becker 2006-07-08 01:02:37 +00:00
parent 325d849332
commit c22ac6678c
3 changed files with 20 additions and 3 deletions

View File

@ -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 @@

View File

@ -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(

View File

@ -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';
}
?>