4

Am using Laravel 5.6

I Tried to migrate purchases table for my project
When i tried to migrate and it's showing Table Space error.

General error: 1813 Tablespace for table 'jshop.purchases' exists. Please DISCARD the tablespace before IMPORT.

Migrate Code Below :

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.

Error Message Image Below : Migration Error image Link How to solve this ?

Full Migration Code Image

7
  • can you share full migrate code? Commented Oct 2, 2018 at 6:23
  • Refer this question stackoverflow.com/questions/15694168/… Commented Oct 2, 2018 at 6:24
  • @sanduniYW sir when am trying to put all code its warning me about length of code. That's why i shared image link below i.sstatic.net/yeH83.jpg please open this. Commented Oct 2, 2018 at 6:31
  • kk..thanks. I add answer below. Plz try it. Commented Oct 2, 2018 at 6:40
  • please put the relevant code in the question as text and not an image. this question becomes less useful if the image link goes down... Commented Oct 2, 2018 at 6:40

4 Answers 4

11

Drop the database and create a new one.

Sign up to request clarification or add additional context in comments.

2 Comments

Although this suggestion is not the most elegant solution to the problem, in some cases, it will work.
It sounds like: "Just reinstall Windows" ))
8

try this:

php artisan migrate:refresh 

if it is not solve this error try this:

Go to mysql/data/database_name /tablename.ibd file and delete it manually. after this try your command php artisan migrate

6 Comments

sir... still facing this problem . :(
you use xampp or wamp?
xampp at windows 10 Operating system
try above solution
sir it's not work ... when i create new database with different name and migrate this . And its work now. Thank you so much for your help sir... your suggestion really good
|
3

Your database is corrupted, do the followinf steps to fix it.

SETP 1. Drop the database and create a new one.

SETP 1. run the following command

php artisan migrate:refresh 

Comments

0

Locate where your database is and delete the table. Then run PHP artisan migrate This worked for me

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.