<?php /** @noinspection PhpUnhandledExceptionInspection */
/**
 * Upgrades the database from version 1.9.2 to version 1.9.3
 * 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.
 */
Log::write(Log::LOGLEVEL_INFO, "In updater, from 1.9.2 to 1.9.3...");

Log::write(Log::LOGLEVEL_INFO, "Datafix: Force default and shared projects issystem=1...");
$sql='UPDATE project SET issystem=1 WHERE name=:name';
database::query($sql, [':name'=>baseproject::DEFAULTPROJECT]);
database::query($sql, [':name'=>baseproject::SHARED]);
Log::write(Log::LOGLEVEL_INFO, "...done");


Log::write(Log::LOGLEVEL_INFO, "Removing redundant columns in homepagebrick table...");
database::query('ALTER TABLE `homepagebrick`  
    DROP `apiurl`, DROP `scriptblock`, DROP `content`, DROP `headertemplates`, DROP `rowtemplates`
');
Log::write(Log::LOGLEVEL_INFO, "...done");

Log::write(Log::LOGLEVEL_INFO, "...update done");

