setting timesheet custom fields to size of other apps: 64 char name, and 16k data, also setting not null constrain on ts_create after creating the column

This commit is contained in:
Ralf Becker 2017-01-18 12:46:39 +01:00
parent 87b955142d
commit 4df3b7b540
3 changed files with 35 additions and 8 deletions

View File

@ -17,7 +17,7 @@ if (!defined('TIMESHEET_APP'))
} }
$setup_info[TIMESHEET_APP]['name'] = TIMESHEET_APP; $setup_info[TIMESHEET_APP]['name'] = TIMESHEET_APP;
$setup_info[TIMESHEET_APP]['version'] = '17.1'; $setup_info[TIMESHEET_APP]['version'] = '17.1.001';
$setup_info[TIMESHEET_APP]['app_order'] = 5; $setup_info[TIMESHEET_APP]['app_order'] = 5;
$setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet','egw_timesheet_extra'); $setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet','egw_timesheet_extra');
$setup_info[TIMESHEET_APP]['enable'] = 1; $setup_info[TIMESHEET_APP]['enable'] = 1;
@ -52,3 +52,4 @@ $setup_info[TIMESHEET_APP]['depends'][] = array(
'appname' => 'api', 'appname' => 'api',
'versions' => Array('16.1') 'versions' => Array('16.1')
); );

View File

@ -24,11 +24,11 @@ $phpgw_baseline = array(
'ts_unitprice' => array('type' => 'float','precision' => '4','comment' => 'unitprice'), 'ts_unitprice' => array('type' => 'float','precision' => '4','comment' => 'unitprice'),
'cat_id' => array('type' => 'int','meta' => 'category','precision' => '4','default' => '0','comment' => 'category'), 'cat_id' => array('type' => 'int','meta' => 'category','precision' => '4','default' => '0','comment' => 'category'),
'ts_owner' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'owner of the timesheet'), 'ts_owner' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'owner of the timesheet'),
'ts_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'Creation date of the timesheet'),
'ts_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'date modified ot the timesheet'), 'ts_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'date modified ot the timesheet'),
'ts_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account id of the last modifier'), 'ts_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account id of the last modifier'),
'pl_id' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'id of the linked project'), 'pl_id' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'id of the linked project'),
'ts_status' => array('type' => 'int','precision' => '4','comment' => 'status of the timesheet-entry') 'ts_status' => array('type' => 'int','precision' => '4','comment' => 'status of the timesheet-entry'),
'ts_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'Creation date of the timesheet')
), ),
'pk' => array('ts_id'), 'pk' => array('ts_id'),
'fk' => array(), 'fk' => array(),
@ -38,8 +38,8 @@ $phpgw_baseline = array(
'egw_timesheet_extra' => array( 'egw_timesheet_extra' => array(
'fd' => array( 'fd' => array(
'ts_id' => array('type' => 'int','precision' => '4','nullable' => False), 'ts_id' => array('type' => 'int','precision' => '4','nullable' => False),
'ts_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '32','nullable' => False), 'ts_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '64','nullable' => False),
'ts_extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '255','nullable' => False,'default' => '') 'ts_extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False,'default' => '')
), ),
'pk' => array('ts_id','ts_extra_name'), 'pk' => array('ts_id','ts_extra_name'),
'fk' => array(), 'fk' => array(),

View File

@ -138,10 +138,36 @@ function timesheet_upgrade16_1()
'type' => 'int', 'type' => 'int',
'meta' => 'timestamp', 'meta' => 'timestamp',
'precision' => '8', 'precision' => '8',
'nullable' => False 'nullable' => true
)); ));
// Initialize to start // Initialize to start
$GLOBALS['egw']->db->query('UPDATE egw_timesheet set ts_created = ts_start'); $GLOBALS['egw']->db->query('UPDATE egw_timesheet set ts_created = ts_start');
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet','ts_created',array(
'type' => 'int',
'meta' => 'timestamp',
'precision' => '8',
'nullable' => False
));
return $GLOBALS['setup_info']['timesheet']['currentver'] = '17.1'; return $GLOBALS['setup_info']['timesheet']['currentver'] = '17.1';
} }
function timesheet_upgrade17_1()
{
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet_extra','ts_extra_name',array(
'type' => 'varchar',
'meta' => 'cfname',
'precision' => '64',
'nullable' => False
));
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet_extra','ts_extra_value',array(
'type' => 'varchar',
'meta' => 'cfvalue',
'precision' => '16384',
'nullable' => False,
'default' => ''
));
return $GLOBALS['setup_info']['timesheet']['currentver'] = '17.1.001';
}