【发布时间】:2018-10-02 06:17:24
【问题描述】:
我正在使用 Laravel 5.6
我尝试为我的项目迁移采购表
当我尝试迁移时,它显示表空间错误。
一般错误:1813 表“
jshop.purchases”的表空间存在。请在 IMPORT 之前丢弃表空间。
迁移下面的代码:
Schema::create('purchases', function (Blueprint $table) {
$table->increments('id');
$table->integer("product_price");
$table->integer("product_qty");
$table->unsignedInteger('invoice_id');
$table->unsignedInteger('product_id');
$table->unsignedInteger('weight_id');
$table->timestamps();
$table->foreign("invoice_id")->references('id')->on('invoices');
$table->foreign("product_id")->references('id')->on('products');
$table->foreign("weight_id")->references('id')->on('weights');
});
invoice,products,weights 表在我的数据库中有效。
错误信息图片如下: Migration Error image Link 如何解决?
【问题讨论】:
-
你能分享完整的迁移代码吗?
-
@sanduniYW 先生,当我试图放置所有代码时,它会警告我代码长度。这就是为什么我在i.stack.imgur.com/yeH83.jpg下方分享了图片链接,请打开这个。
-
kk..谢谢。我在下面添加答案。请尝试一下。
-
请将问题中的相关代码作为文本而不是图像。如果图片链接断开,这个问题就会变得不那么有用......
标签: php mysql laravel laravel-5.6