Watching video tutorials on Laravel. He creates and deletes the migration several times. I created, then deleted, and when I try to create a migration again with the same name, an error comes out. What can be wrong? PS On the screenshot, the name of the migration is the first thing that came to mind for example.
3 answers
When you create migrations, they are created not only in the migration folder, but also in the database. And if you then simply delete the file, then the next time you start the migrations, it will not find this file. Run php artisan migrate: refresh This rolls back all migrations and then runs the migrate command.
- I did not apply migration, only created. Then delete, try to create again - an error as in the screenshot. - Djonson
- composer dump-autoload - Andrey Svyrydov
- Yes, it really helped. - Djonson
|
I have not tried it myself, but they say this method works:
At first
composer dump-autoload Then
php artisan migrate:rollback - Yes, it helps. Thank. - Djonson
|
You can still delete all tables and re-create
php artisan migrate:refresh And also
php artisan migrate:rollback --step=1 Removes the most recently created table.
|
