* Calendar: Try alter description to varchar(16384), to not force temp. tables to disk on MySQL (because of text columns)

This commit is contained in:
Ralf Becker 2012-08-12 09:49:54 +00:00
parent c0f83a275d
commit 7eec30c57a
3 changed files with 34 additions and 8 deletions

View File

@ -10,7 +10,7 @@
*/
$setup_info['calendar']['name'] = 'calendar';
$setup_info['calendar']['version'] = '1.9.005';
$setup_info['calendar']['version'] = '1.9.006';
$setup_info['calendar']['app_order'] = 3;
$setup_info['calendar']['enable'] = 1;
$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index';
@ -68,6 +68,3 @@ $setup_info['calendar']['check_install'] = array(
'from' => 'Calendar',
),
);

View File

@ -15,12 +15,12 @@ $phpgw_baseline = array(
'cal_id' => array('type' => 'auto','nullable' => False),
'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'),
'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'),
'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'),
'cal_category' => array('type' => 'varchar','precision' => '64','comment' => 'category id(s)'),
'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'),
'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'),
'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'),
'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'),
'cal_description' => array('type' => 'text'),
'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False),
'cal_description' => array('type' => 'varchar','precision' => '16384'),
'cal_location' => array('type' => 'varchar','precision' => '255'),
'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'),
'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'),
@ -61,7 +61,7 @@ $phpgw_baseline = array(
'recur_type' => array('type' => 'int','precision' => '2','nullable' => False),
'recur_enddate' => array('type' => 'int','precision' => '8'),
'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'),
'recur_data' => array('type' => 'int','precision' => '2','default' => '1'),
'recur_data' => array('type' => 'int','precision' => '2','default' => '1')
),
'pk' => array('cal_id'),
'fk' => array(),

View File

@ -2127,3 +2127,32 @@ function calendar_upgrade1_9_004()
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.005';
}
/**
* Try alter description to varchar(16384), to not force temp. tables to disk on MySQL (because of text columns)
*/
function calendar_upgrade1_9_005()
{
// only alter description to varchar(16384), if it does NOT contain longer input and it can be stored as varchar
$max_description_length = $GLOBALS['egw']->db->query('SELECT MAX(CHAR_LENGTH(cal_description)) FROM egw_cal')->fetchColumn();
if (is_numeric($max_description_length) && $max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384)
{
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array(
'type' => 'varchar',
'precision' => '16384'
));
}
// allow more categories
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array(
'type' => 'varchar',
'precision' => '64',
'comment' => 'category id(s)'
));
// remove silly default of 1
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array(
'type' => 'varchar',
'precision' => '255',
'nullable' => False
));
return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.006';
}