From 7eec30c57a3f511c5c0567991eaa8cad73e228f5 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 12 Aug 2012 09:49:54 +0000 Subject: [PATCH] * Calendar: Try alter description to varchar(16384), to not force temp. tables to disk on MySQL (because of text columns) --- calendar/setup/setup.inc.php | 5 +---- calendar/setup/tables_current.inc.php | 8 ++++---- calendar/setup/tables_update.inc.php | 29 +++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index c85a3276fe..c7e091ece3 100755 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -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', ), ); - - - diff --git a/calendar/setup/tables_current.inc.php b/calendar/setup/tables_current.inc.php index 51eb97b535..e681a62019 100644 --- a/calendar/setup/tables_current.inc.php +++ b/calendar/setup/tables_current.inc.php @@ -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(), diff --git a/calendar/setup/tables_update.inc.php b/calendar/setup/tables_update.inc.php index 1a77264cb3..d2295eeea1 100644 --- a/calendar/setup/tables_update.inc.php +++ b/calendar/setup/tables_update.inc.php @@ -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'; +} +