<?php

use yii\db\Migration;

/**
 * Handles the creation for table `tax_option_lang`.
 */
class m160930_151832_create_tax_option_lang_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('tax_option_lang', [
            'tax_option_id' => $this->integer()
                                   ->notNull(),
            'language_id'  => $this->integer()
                                   ->notNull(),
            'value'         => $this->string()
                                   ->notNull(),
        ]);
        $this->createIndex('tax_option_lang_tax_option_language_key', 'tax_option_lang', [
            'tax_option_id',
            'language_id',
        ], true);
    
        $this->addForeignKey('tax_option_fk', 'tax_option_lang', 'tax_option_id', 'tax_option', 'tax_option_id', 'CASCADE', 'CASCADE');
        $this->addForeignKey('language_fk', 'tax_option_lang', 'language_id', 'language', 'language_id', 'RESTRICT', 'CASCADE');
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('tax_option_lang');
    }
}
