m210603_142134_filters.php
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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()->notNull()->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}}');
}
}