for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use yii\db\Migration;
class m151220_112320_lang extends Migration
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
public function safeUp()
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%lang}}', [
'id' => $this->string(2)->notNull(),
'locale' => $this->string(8)->notNull(),
'name' => $this->string(32)->notNull(),
'status' => $this->smallInteger(),
'PRIMARY KEY (id)',
], $tableOptions);
$this->createIndex('lang_name_idx', 'lang', 'name', true);
$this->createIndex('lang_status_idx', 'lang', 'status');
$this->insert('lang', [
'id' => 'en',
'locale' => 'en-US',
'name' => 'ENG',
'status' => 10,
]);
public function safeDown()
$this->dropTable('lang');
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.