<?php

/**
 * Created by PhpStorm.
 * User: ondra
 * Date: 9.1.18
 * Time: 7:38.
 */

namespace KupShop\AdminBundle\Resources\upgrade;

class MenuLinksUpgrade extends \UpgradeNew
{
    public function check_figureColumn()
    {
        return $this->checkColumnExists('menu_links', 'figure');
    }

    /** Add figure column into menu_links table */
    public function upgrade_figureColumn()
    {
        sqlQuery('ALTER TABLE menu_links ADD COLUMN figure ENUM("Y", "N") DEFAULT "Y"');

        $this->upgradeOK();
    }

    public function check_dataColumn()
    {
        return $this->checkColumnExists('menu_links', 'data');
    }

    /** Add 'data' column into table 'menu_links' */
    public function upgrade_dataColumn()
    {
        sqlQuery('ALTER TABLE menu_links ADD COLUMN data MEDIUMTEXT DEFAULT NULL');

        $this->upgradeOK();
    }

    public function check_showInSearchColumn()
    {
        return $this->checkColumnExists('menu_links', 'show_in_search');
    }

    /** Add 'data' column into table 'menu_links' */
    public function upgrade_showInSearchColumn()
    {
        sqlQuery('ALTER TABLE menu_links ADD COLUMN show_in_search enum (\'Y\', \'N\') default \'Y\' null after figure');

        $this->upgradeOK();
    }
}
