2016-08-23 65 views
7

Alan ENUM yapar ve CMD pencerelerinde yii migrate/up kullandığımda hata oluşur. Her DB ENUM alanlarını destekliyor değil çünkü şu anda hiçbir enum() yöntemi yokturAlan enum geçişi nasıl yapılır 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); 
} 

When I migrate/up error

cevap

19

. gerçi elle yapabilirsiniz:

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

Tamam sayesinde çözüldü – CrashBurn

+0

Sonra sloved olarak, please :) işaretleyin .. –

+2

gelecekte değişir ihtimale bu konuda açık bir tartışma: https://github.com/ yiisoft/yii2/sorunlar/9797 –