throwExeptions(true);
$update_datetime = array(
'{chatthread}' => array(
'dtmcreated',
'dtmchatstarted',
'dtmmodified',
'lastpinguser',
'lastpingagent'
),
'{chatmessage}' => array(
'dtmcreated'
),
'{chatoperator}' => array(
'dtmlastvisited',
'dtmrestore'
),
'{chatban}' => array(
'dtmcreated',
'dtmtill'
),
'{chatsitevisitor}' => array(
'firsttime',
'lasttime',
'invitationtime'
),
'{visitedpage}' => array(
'visittime'
),
'{visitedpagestatistics}' => array(
'visittime'
)
);
foreach($update_datetime as $table => $columns) {
echo("Table: {$table}
");
foreach($columns as $column) {
echo("-- Column: {$column}
");
$db->query("ALTER TABLE {$table} CHANGE {$column} {$column}_tmp datetime");
$db->query("ALTER TABLE {$table} ADD COLUMN {$column} int NOT NULL DEFAULT 0 AFTER {$column}_tmp");
$db->query("UPDATE {$table} SET {$column} = UNIX_TIMESTAMP({$column}_tmp)");
$db->query("ALTER TABLE {$table} DROP COLUMN {$column}_tmp");
}
}
?>