jgravois's avatar

[HELP] Refeshing database with artisan migrate:refresh --seed now errors out

I have a Terminal alias (reseed) that runs "artisan migrate:refresh --seed" to clean out my development db and I use it pretty regularly.

This morning I started getting this error:

{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'CreateCroppracticesTable' not found","file":"\/Users\/jgravois\/sites\/armlend\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Migrations\/Migrator.php","line":299}}%

As I understand that error, it is looking for a migration file to create the Croppractices table and that migration file is still in the project and that table gets rebuilt like it should.

The only way that I can get back to work is to delete the "2014_10_11_044410_create_croppractices_table" record from the migrations table, delete the croppractices table manually and run "composer dump-autoload -o" and then the "reseed" command works perfectly.

Needless to say, this is killing my workflow. I didn't make any changes this morning to files that would affect this and I don't know how to fix this permanently.

Any help is greatly appreciated.

0 likes
4 replies
MThomas's avatar

Does manually emptying out your DB help? I sometimes get the error on an unexpected moment and often the migrations table is messed up.

jgravois's avatar

are you suggesting that I drop and add the entire database? If so, would I run artisan migrate --seed to restore?

MThomas's avatar

yes that is what I'm suggesting. I'd like to know what will happen when you start with a clean DB (no migrations or any other table). After that run php artisan migrate --seed and let us know what will happen.

jgravois's avatar

I used Sequel Pro and dropped the database. I added the database with the same tool and ran php artisan migrate --seed and it restored the database without complaint.

I made a cosmetic change to a seed file and ran my reseed alias and got the same error.

Please or to participate in this conversation.