<?php

class Upgrade5 extends UpgradeNew
{
    // overi, jestli je opravnene provest upgrade
    public function checkRightfulness_1()
    {
        $change = true;

        $SQL = sqlQuery('SHOW FIELDS FROM '.getTableName('menu_links'));
        while ($row = sqlFetchArray($SQL)) {
            if ($row['Field'] == 'parent') {
                $change = false;
                break;
            }
        }

        return $change;
    }

    // provest samotny upgrade
    public function makeChanges_1()
    {
        sqlQuery('ALTER TABLE '.getTableName('menu_links')." ADD parent INT NOT NULL DEFAULT '0' AFTER id;");

        $this->upgradeOK();
    }
}
