How to add a new column with Yii 2 migrations on a specific position in a table?

public function up()
{
    $this->addColumn('contacts', 'email', $this->string(64)->after('id'));
}

You can use migration command for that as below :

php yii migrate/create add_email_column_to_contacts_table --fields="email:string(64):after('id')"

Solved it. If anyone faces the same issue, this is the solution I used:

public function up()
{
    $this->addColumn('contacts', 'email', 'VARCHAR(64) AFTER id');
}

EDIT: From version Yii 2.0.8 you can use this chained syntax as well:

$this->addColumn('contacts', 'email', $this->string(64)->after('id'));