我想通过 Yii2 中的迁移添加一个新列,使用以下代码:
public function up()
{
$this->addColumn('news', 'priority', $this->integer());
}
public function down()
{
$this->dropColumn('news', 'priority');
}
Run Code Online (Sandbox Code Playgroud)
它有效,但我希望它成为名称之后的第二列。
有可能的?
好的,你可以试试这个:
$this->addColumn('news', 'priority', 'integer AFTER `name`');
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2055 次 |
最近记录: |