Language:

Search

Laravel Migrations Issue: When Deleting A Migration File

  • Share this:
Laravel Migrations Issue: When Deleting A Migration File

Introduction

Working with Laravel is amazing it feels magical but sometimes you get stuck in those magics Laravel is doing for you behind the scene. one of them is when you create a migration, Laravel automatically adds the migration file to composer’s auto-loader.

1*Wd7f7luDtQS3XPqPPNi9fA.png

If you decide not to use the migration you just created and you want to delete it. Wait… if you did that you will get an error next time when you run

$ php artisan migrate

Here is how the error looks like

1*V6_kAvLAlv_uMmjbaQEyGw.png

the quick fix to this issue is run the the following command

composer dump-autoload

It will remap the classes in you /database directory and will remove all the non-existent files.

Here is how i did that

 
1*KlrTz3wGnEwEy8t7h1xhsg.png

Thanks,

Follow me on Twitter : @azibaloch

Azeem Hassni

Azeem Hassni

I write code and i love it. I do write blogs on things which I am passionate about. I love to Explore the internet of things and whats new in web technologies. My topic of Interests include WordPress, Laravel & Magento to name a few.