<?php

use yii\db\Migration;
use yii\db\Schema;

/**
 * Handles the creation of table `{{%goods_index}}`.
 */
class m181206_153417_create_goods_index_table extends Migration
{
    public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('{{%goods_index}}', [
            'id' => Schema::TYPE_PK,
            'goods_id' => $this->integer(11)->notNull(),
            'entity' => $this->string(80)->notNull(),
            'entity_id' => $this->integer(11)->notNull(),
            'attribute' => $this->string(20)->notNull()
        ], $this->tableOptions);
    }

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