我试图为我的项目迁移购买表 当我尝试迁移时,它显示表空间错误。
一般错误: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');
});
错误信息图片如下:Migration Error image Link如何解决这个问题?
试试这个:
php artisan migrate:refresh
如果没有解决这个错误,试试这个:
转到mysql/data/database_name /tablename.ibd file
并手动删除它。在此之后尝试你的命令php artisan migrate
删除数据库并创建一个新数据库。