I am deploying a Laravel barebone project to Microsoft Azure, but whenever I try to execute php artisan migrate
I get the error:
[2015-06-13
Make sure your migrations filename matches with migration class name
FOR EXAMPLE:
If name of migration is:
2020_10_31_161839_create_notifications_table
Then the class name should be:
CreateNotificationsTable
Simply make sure your migration filename is the same as your class name.
i.e:
If filename is:
xxx_151955_create_post_translations_table.php
Then class should be:
CreatePostTranslationsTable
In my case was the auto-increment of the database, In the past I did remove manually one entry, and AUTO_INCREMENT
was pointing one more than the next id in the table.
Apparently Laravel uses AUTO_INCREMENT
-1 to know which was the last migration done.
I had a similar situation (class not found error) after moving a Laravel 5.2 dev project to production. The production server was looking for class "project" but the controller name was Project.php. Once I renamed the file to project.php it was good to go.
For me, the problem was that I had named my migration 2017_12_15_012645_create_modules_problems.php, with the class name of CreateModulesProblemsTable. As soon as I added _table to the filename, everything worked fine.
I had this same problem a while back. Apparently it is a common problem because in the documentation for Laravel, it even suggests it: http://laravel.com/docs/master/migrations#running-migrations
Basically all you have to do is refresh some composer files. Simply run:
composer dump-autoload
This will refresh composer autoload files and then you can run your normal migration and it should work! Very best.