I can't run migrate:refresh
(with or without --seed) or migrate:reset
anymore after deleting a migration file.
Running composer dump-autoload
or composer update
won't help either.
Any ideas?
Here's the code:
$ artisan migrate:refresh
PHP Fatal error: Class 'AddCommentsToDevicesTable' not found in /Users/florianharbecke/Sites/trackle/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 301
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'AddCommentsToDevicesTable' not found","file":"\/Users\/florianharbecke\/Sites\/trackle\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Migrations\/Migrator.php","line":301}}
Any ideas on how to fix the issue?
If you deleted the file you should delete the matching row from the migrations table in your DB. Don't delete a migration without doing migrate:reset first.
Thanks for the help! I figured it out :)
Yeap this works
thanks
Also you have to run composer dump-autoload
command from your terminal after removing the migration file to automatically update vendor/composer/autoload_classmap.php
and vendor/composer/autoload_static.php
composer autoload files.
I deleted migration file first, then delete the migrations table in database, and run composer dump-autoload. But still have errors like this:
[ErrorException]
Undefined index: 2016_12_01_044011_create_reward_request_inboxes_table
I use Laravel 5.3 and PHP 7
@langocthach: as @taylorotwell says you must first do: $ php artisan migrate:reset
then delete the migration, after that you can follow $ composer dump-autoload
.
If you are a newb like me, and accidentally delete the migration before running reset, you will need to go into the database and remove the corresponding record from the table migrations (make sure to apply your changes so that the index is also updated, or you will get an index error).
@taylorotwell thanks,it works for me !
i made a mistake i then remove a particular field from the migration. i run php artisan migrate:refresh so as to apply the changes but i got an error. what can i do. that's the error i got below
[ErrorException]
Undefined index: 2016_12_01_044011_create_tasks_table
Thanks for the reply, i really do appreciate, i think this will work
On Sun, Jun 25, 2017 at 4:30 AM, Clayton Stone notifications@github.com
wrote:
php artisan fresh
If artisan rollback doesn't work, you can try "fresh"which ignores the rollback command. Otherwise, just add the "step" command
to each rollback. --step1, etc.php artisan optimize
php artisan dumpauto -o
Then rebuild each migration file, one at a time.
You can do It!—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/laravel/framework/issues/2105#issuecomment-310879918,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AUJxnms-tzV7PMvehtyGVB51c0hOh0v-ks5sHdRNgaJpZM4A57SW
.
--
Best Regards,
Amah Gift,
Solution Developer/Software (Web) Developer
HostNowNow.com
+2348096460341
www.linkedin.com/in/amah-gift-67a55311a
I accidently stopped the php artisan migrate:refresh in the middle and I am not able to run php artisan migrate ..... is there any solution what's happening ??
Most helpful comment
If you deleted the file you should delete the matching row from the migrations table in your DB. Don't delete a migration without doing migrate:reset first.