2016-08-23 1 views
7

필드 ENUM을 만들고 CMD 창에서 yii migrate/up을 사용하면 결과가 잘못됩니다. 모든 DB는 ENUM 필드를 지원하지 이후 순간에 더 열거() 메소드가 없습니다필드 열거 형 마이그레이션을 수행하는 방법

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); 
} 

When I migrate/up error

답변

19

. 하지만 당신은 수동으로 작업을 수행 할 수 있습니다

'social_media' => "ENUM('facebook', 'google', 'twitter', 'github')", 
+0

확인 감사를 해결 – CrashBurn

+0

그런 다음 sloved로, :)하십시오를 표시 .. –

+2

는 미래의 변화 단지의 경우에 대한 열린 토론 : https://github.com/ yiisoft/yii2/issues/9797 –