7
我使字段ENUM和结果是错误时,我在CMD窗口上使用yii migrate/up
。如何使字段枚举迁移yii2
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);
}
好的解决感谢.. – CrashBurn
然后将其标记为sloved,请:) –
以防万一它的公开讨论它在未来的变化:https://github.com/ yiisoft/yii2 /问题/ 9797 –