<?php
/**
 * Upgrades the database from version 1.2.0 to version 1.2.1.
 * DO NOT call this directly, it will fail.
 * To be included from classes/core/updater.class.php.
 * Assumes that logging has already been init()ed. Log class will throw ServerException if not.
 */

$tables=array();
$result=database::queryGetAll('SHOW TABLES');
foreach($result['rows'] as $row){
    foreach($row as $k=>$v){
        $tables[]=$v;
    }
}
/*
if(in_array('testtable', $tables)){
    Log::write(Log::LOGLEVEL_INFO, "Test table testtable already exists");
} else {
    Log::write(Log::LOGLEVEL_INFO, "Creating test table testtable...");
    database::query("
        CREATE TABLE IF NOT EXISTS `testtable` (
        `id` bigint(20) unsigned NOT NULL,
        `name` varchar(250) COLLATE utf8_bin NOT NULL,
        UNIQUE KEY `id` (`id`),
        UNIQUE KEY `name` (`name`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Test table';
    ");    
    Log::write(Log::LOGLEVEL_INFO, "Created test table.");
}
*/
Log::write(Log::LOGLEVEL_INFO, "Update script completed.");
