Рассмотрим добавление enum на примере простой миграции
<?php
use yii\db\Migration;
use common\components\notifier\Recipients;
/**
* Handles the creation of table `recipients`.
*/
class m191025_122536_create_recipients_table extends Migration
{
/**
* @inheritdoc
*/
public function safeUp()
{
$this->createTable('recipients', [
'id' => $this->primaryKey(),
'recipientsTypeId' => $this->integer(),
'recipients' => $this->string()
]);
$this->execute("CREATE TYPE channel as ENUM('email','telegram')");
$this->addColumn(Recipients::tableName(), 'channel', 'channel NULL DEFAULT NULL');
}
/**
* @inheritdoc
*/
public function safeDown()
{
$this->dropTable('recipients');
$this->execute('DROP TYPE channel');
}
}