I had a good working Laravel structure with database migrations and seeding. But I wanted my migration file,classes,db table be renamed to CreateOrganizationsTable instead of CreateOrganisationsTable
So I changed the migration filename, all classes and routes.
But when I execute php artisan migrate:reset
in my Homestead box, I get the following error:
PHP Fatal error: Class 'CreateOrganisationsTable' not found in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 299
Artisan created some link I'm unable to fix at the moment.
Yes, you can name them however you want, but they will run in alphabetical order (which is why laravel timestamps them). Also you can change a migrations name after the fact (you've already run the migration).
If you've only created the migration and you've not executed the php artisan migrate command, all you would need to do to remove the migration is to delete the file. You could do that via your text editor or the command line with the rm command.
IF you want to re-migrate all the database, you can simply do: php artisan migrate:refresh . IF you want to make sure your database to be clean with your latest changes, you can drop your entire database tables and do php artisan migrate again. Also, you can try php artisan migrate --seed if you have any seeder.
As Morale mentioned you must reset or rollback to a point before your new migration or make the changes manually. I knew this but was still getting the problem after changing only the timestamps to have the migrations run in a different order.
You must run composer dump-autoload
even if you didn't change the class name.
Don't forget to also rename the class inside the file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With