<?php use yii\db\Migration; /** * Class m210603_142134_filters */ class m210603_142134_filters extends Migration { /** * {@inheritdoc} */ public function safeUp() { $this->createTable('{{%filters}}', [ 'id' => $this->primaryKey(), 'pattern' => $this->text()->notNull()->comment('Паттерн'), 'created' => $this->dateTime()->comment('Дата записи'), 'include' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Исключение или включение'), 'status' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Статус'), 'type' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Тип'), ], 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB'); $this->createIndex('idx-status', '{{%filters}}', 'status'); $this->createIndex('idx-type', '{{%filters}}', 'type'); } /** * {@inheritdoc} */ public function safeDown() { $this->dropIndex('idx-type', '{{%filters}}'); $this->dropIndex('idx-status', '{{%filters}}'); $this->dropTable('{{%filters}}'); } }