example of tables fucntion
Code
function Welcome_pntables()
{
// Initialise table array
$pntable = array();
// Full table definition
$pntable['welcomedata'] = DBUtil::getLimitedTablename('welcomedata');
$pntable['welcomedata_column'] = array ('welid' => 'pn_id',
'blurb' => 'pn_blurb',
'bcolor' => 'pn_color',
'layout' => 'pn_layout');
$pntable['welcomedata_column_def'] = array('welid' => 'I NOTNULL AUTO PRIMARY',
'blurb' => "X NOTNULL DEFAULT ''",
'bcolor' => "X NOTNULL DEFAULT ''",
'layout' => "X NOTNULL DEFAULT 'left'");
$pntable['welcomedata_primary_key_column'] = 'welid';
//image tables added version 0.4
$pntable['welcomeimages'] = DBUtil::getLimitedTablename('welcomeimages');
$pntable['welcomeimages_column'] = array ('iid' => 'pn_id',
'imageurl' => 'pn_imageurl',
'width' => 'pn_width',
'imagelink' => 'pn_imagelink',
'thumb' => 'pn_thumb',
'newwindow' => 'pn_newwindow',
'isblock' => 'pn_isblock',
'parnetid' => 'pn_parentid');
$pntable['welcomeimages_column_def'] = array('iid' => 'I NOTNULL AUTO PRIMARY',
'imageurl' => 'X DEFAULT NULL',
'width' => 'I NULL',
'imagelink' => "X NOTNULL DEFAULT ''",
'thumb' => "X NOTNULL DEFAULT ''",
'newwindow' => 'I1 DEFAULT 0',
'isblock' => 'I1 DEFAULT 0',
'parnetid' => 'I NULL');
$pntable['welcomeimages_primary_key_column'] = 'iid';
// end of image tables added at version 0.4
$pntable['welcomedata'] = DBUtil::getLimitedTablename('welcomedata');
$pntable['welcomeimages'] = DBUtil::getLimitedTablename('welcomeimages');
return $pntable;
}
{
// Initialise table array
$pntable = array();
// Full table definition
$pntable['welcomedata'] = DBUtil::getLimitedTablename('welcomedata');
$pntable['welcomedata_column'] = array ('welid' => 'pn_id',
'blurb' => 'pn_blurb',
'bcolor' => 'pn_color',
'layout' => 'pn_layout');
$pntable['welcomedata_column_def'] = array('welid' => 'I NOTNULL AUTO PRIMARY',
'blurb' => "X NOTNULL DEFAULT ''",
'bcolor' => "X NOTNULL DEFAULT ''",
'layout' => "X NOTNULL DEFAULT 'left'");
$pntable['welcomedata_primary_key_column'] = 'welid';
//image tables added version 0.4
$pntable['welcomeimages'] = DBUtil::getLimitedTablename('welcomeimages');
$pntable['welcomeimages_column'] = array ('iid' => 'pn_id',
'imageurl' => 'pn_imageurl',
'width' => 'pn_width',
'imagelink' => 'pn_imagelink',
'thumb' => 'pn_thumb',
'newwindow' => 'pn_newwindow',
'isblock' => 'pn_isblock',
'parnetid' => 'pn_parentid');
$pntable['welcomeimages_column_def'] = array('iid' => 'I NOTNULL AUTO PRIMARY',
'imageurl' => 'X DEFAULT NULL',
'width' => 'I NULL',
'imagelink' => "X NOTNULL DEFAULT ''",
'thumb' => "X NOTNULL DEFAULT ''",
'newwindow' => 'I1 DEFAULT 0',
'isblock' => 'I1 DEFAULT 0',
'parnetid' => 'I NULL');
$pntable['welcomeimages_primary_key_column'] = 'iid';
// end of image tables added at version 0.4
$pntable['welcomedata'] = DBUtil::getLimitedTablename('welcomedata');
$pntable['welcomeimages'] = DBUtil::getLimitedTablename('welcomeimages');
return $pntable;
}
the data in the "welcomeimages" table used to all be in the "welcomedata" table but it is being split out into its own table.
so in my upgrade function theres a switch and for this versions case i create the new table
Code
case 0.3:
if (!DBUtil::createTable('welcomeimages')) {
return false;
}
// get all welcome items
$objArray = DBUtil::selectObjectArray('welcomedata');
foreach ($objArray as $item) {
return LogUtil::registerError($item);
if (!DBUtil::createTable('welcomeimages')) {
return false;
}
// get all welcome items
$objArray = DBUtil::selectObjectArray('welcomedata');
foreach ($objArray as $item) {
return LogUtil::registerError($item);
what is returned is
Code
4
blurb
#DCDCDC
left
blurb
#DCDCDC
left
that info corresponds exactly to the columns that are still left in the pntables file for that table. however that data is not missing from the SQL table
can someone help me i need to figure out how to migrate those columns from one table to another.
