Illuminate \ Database \ QueryException:SQLSTATE [HY000]:常规错误:1813表空间

问题描述 投票:0回答:2

Am using 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 table are valid in my database.

错误信息图片如下:Migration Error image Link如何解决这个问题?

Full Migration Code Image

php mysql laravel laravel-5.6
2个回答
0
投票

试试这个:

php artisan migrate:refresh

如果没有解决这个错误,试试这个:

转到mysql/data/database_name /tablename.ibd file并手动删除它。在此之后尝试你的命令php artisan migrate


0
投票

删除数据库并创建一个新数据库。

© www.soinside.com 2019 - 2024. All rights reserved.