我正在这样做:
创建:
php artisan make:migration add_total_invoice --table=invoices
代码:
public function up()
{
Schema::table('invoices', function (Blueprint $table) {
$table->double('total')->after('type');
});
}
public function down()
{
Schema::table('invoices', function (Blueprint $table) {
$table->dropColumn('total');
});
}
php artisan migrate
迁移运行没有问题,但是我要检查表并且没有添加列,如果我创建一个新的迁移并将总计放入新列,它说该列已经存在,是什么错误发生?
答案 0 :(得分:0)
转到数据库表并删除表中的前一个总计列,然后再次转到迁移表并删除最后一次迁移。然后再次运行php artisan migrate