<?php

namespace KupShop\KupShopBundle\Resources\upgrade;

class DimensionsUpgrade extends \UpgradeNew
{
    public function check_dimensionsColumns()
    {
        return $this->checkColumnExists('products', 'width');
    }

    /** Add width height depth columns to products and products_variations*/
    public function upgrade_dimensionsColumns()
    {
        sqlQuery('ALTER TABLE products ADD COLUMN width DECIMAL(15,4) DEFAULT NULL');
        sqlQuery('ALTER TABLE products ADD COLUMN height DECIMAL(15,4) DEFAULT NULL');
        sqlQuery('ALTER TABLE products ADD COLUMN depth DECIMAL(15,4) DEFAULT NULL');
        sqlQuery('ALTER TABLE products_variations ADD COLUMN width DECIMAL(15,4) DEFAULT NULL');
        sqlQuery('ALTER TABLE products_variations ADD COLUMN height DECIMAL(15,4) DEFAULT NULL');
        sqlQuery('ALTER TABLE products_variations ADD COLUMN depth DECIMAL(15,4) DEFAULT NULL');

        $this->upgradeOK();
    }
}
