<?php
    
    use yii\db\Migration;
    
    class m161004_102751_add_lang_column extends Migration
    {
        
        public function up()
        {
            $this->addColumn('articles_lang', 'alias', $this->string(255));
            $this->addColumn('brand_lang', 'alias', $this->string(255));
            $this->addColumn('category_lang', 'alias', $this->string(255));
            $this->addColumn('event_lang', 'alias', $this->string(255));
            $this->addColumn('page_lang', 'alias', $this->string(255));
            $this->addColumn('product_lang', 'alias', $this->string(255));
            $this->addColumn('project_lang', 'alias', $this->string(255));
            $this->addColumn('service_lang', 'alias', $this->string(255));
            $this->addColumn('tax_group_lang', 'alias', $this->string(255));
            $this->addColumn('tax_option_lang', 'alias', $this->string(255));
            $this->createIndex('articles_lang_alias', 'articles_lang', 'alias', true);
            $this->createIndex('brand_lang_alias', 'brand_lang', 'alias', true);
            $this->createIndex('category_lang_alias', 'category_lang', 'alias', true);
            $this->createIndex('event_lang_alias', 'event_lang', 'alias', true);
            $this->createIndex('page_lang_alias', 'page_lang', 'alias', true);
            $this->createIndex('product_lang_alias', 'product_lang', 'alias', true);
            $this->createIndex('project_lang_alias', 'project_lang', 'alias', true);
            $this->createIndex('service_lang_alias', 'service_lang', 'alias', true);
            $this->createIndex('tax_group_lang_alias', 'tax_group_lang', 'alias', true);
            $this->createIndex('tax_option_lang_alias', 'tax_option_lang', 'alias', true);
        }
        
        public function down()
        {
            $this->dropIndex('articles_lang_alias', 'articles_lang');
            $this->dropIndex('brand_lang_alias', 'brand_lang');
            $this->dropIndex('category_lang_alias', 'category_lang');
            $this->dropIndex('event_lang_alias', 'event_lang');
            $this->dropIndex('page_lang_alias', 'page_lang');
            $this->dropIndex('product_lang_alias', 'product_lang');
            $this->dropIndex('project_lang_alias', 'project_lang');
            $this->dropIndex('service_lang_alias', 'service_lang');
            $this->dropIndex('tax_group_lang_alias', 'tax_group_lang');
            $this->dropIndex('tax_option_lang_alias', 'tax_option_lang');
            $this->dropColumn('articles_lang', 'alias');
            $this->dropColumn('brand_lang', 'alias');
            $this->dropColumn('category_lang', 'alias');
            $this->dropColumn('event_lang', 'alias');
            $this->dropColumn('page_lang', 'alias');
            $this->dropColumn('product_lang', 'alias');
            $this->dropColumn('project_lang', 'alias');
            $this->dropColumn('service_lang', 'alias');
            $this->dropColumn('tax_group_lang', 'alias');
            $this->dropColumn('tax_option_lang', 'alias');
        }
    }
