for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use yii\db\Migration;
/**
* Class m200505_091520_add_localname
*/
class m200505_091520_add_localname extends Migration
{
* {@inheritdoc}
public function safeUp()
$this->addColumn('language', 'native_name', $this->string(255)->after('name')->null()->comment('Language name in local'));
$this->update('language', ['native_name' => new \yii\db\Expression('name')]);
$this->alterColumn('language', 'native_name', $this->string(255)->notNull()->comment('Language name in local'));
$this->update('language', ['native_name' => 'Eesti'], ['language_id' => 2]);
$this->update('language', ['native_name' => 'Русский'], ['language_id' => 3]);
$this->update('language', ['native_name' => 'Suomi'], ['language_id' => 4]);
$this->update('language', ['native_name' => 'Latviešu'], ['language_id' => 5]);
$this->update('language', ['native_name' => 'Lietuvių'], ['language_id' => 6]);
}
public function safeDown()
$this->dropColumn('language', 'native_name');