diff --git a/src/messenger/webim/install/migrate.php b/src/messenger/webim/install/migrate.php new file mode 100644 index 00000000..d51b4a11 --- /dev/null +++ b/src/messenger/webim/install/migrate.php @@ -0,0 +1,69 @@ +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"); + } +} + + +?> \ No newline at end of file