Yii2 迁移 - 在其他列之后添加列

emp*_*imd 4 yii2

我想通过 Yii2 中的迁移添加一个新列,使用以下代码:

public function up()
{
    $this->addColumn('news', 'priority', $this->integer());
}

public function down()
{
    $this->dropColumn('news', 'priority');
}
Run Code Online (Sandbox Code Playgroud)

它有效,但我希望它成为名称之后的第二列。

有可能的?

XTL*_*XTL 5

好的,你可以试试这个:

$this->addColumn('news', 'priority', 'integer AFTER `name`');
Run Code Online (Sandbox Code Playgroud)