yii2 create migration from existing database code example
Example 1: yii2 migration add column
yii migrate/create add_position_column_to_post_table --fields="position:integer"
Example 2: yii2 migration add column
class m150811_220037_add_position_column_to_post_table extends Migration
{
public function up()
{
$this->addColumn('post', 'position', $this->integer());
}
public function down()
{
$this->dropColumn('post', 'position');
}
}