小编Cra*_*urn的帖子

如何进行字段枚举迁移yii2

我使用字段ENUM,当我yii migrate/up在CMD窗口上使用时结果是错误的.

public function up()
{
    $tableOptions = null;
    if ($this->db->driverName === 'mysql') {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
    }

    $this->createTable('{{%user_social_media}}', [
        'social_media' => $this->ENUM('facebook', 'google', 'twitter', 'github'),
        'id' => $this->primaryKey(),
        'username' => $this->string(),
        'user_id' => $this->integer(11),
        'created_at' => $this->integer(11),
        'updated_at' => $this->integer(11),            
       ], $tableOptions);
}
Run Code Online (Sandbox Code Playgroud)

当我迁移/ up错误

migration enums data-migration yii yii2

15
推荐指数
1
解决办法
9679
查看次数

标签 统计

data-migration ×1

enums ×1

migration ×1

yii ×1

yii2 ×1