Nothing to migrate

0

Hello, I'm starting in php plus the Laravel framework, and my doubt is regarding the command php artisan migrate  to migrate a table in the database.

When I ran the command for the first time it presented this message Nothing to migrate after a few more tries, closing and opening the command prompt it worked.

To avoid any doubt I deleted the table and executed the command again, and the message reappears. I researched in several places and many said that I should take this parameter --path=app/foo/migrations/2014_01_21_143531_create_teams_table.php (example) which I used only to see if it worked, still the message still appears. I hope someone can explain me a little more about this command and what causes this Nothing to migrate message.

    
asked by anonymous 18.09.2015 / 06:55

2 answers

1

To recreate all tables and run seed files, just run the command below.

php artisan migration:refresh --seed  

He will roll back his bank and will recreate the bank.

Documentation: link ;

    
18.09.2015 / 14:41
0

When you run a migration in Laravel, all records are written (by default) in the migrations table. It contains information on which migrations were performed.

If you delete the table "on hand", without clearing this table migrations (not recommended), it will recognize as if the migrations were executed, even if the tables referring to them do not exist.

As recommended, you should use the command below to re-run all migrations.

php artisan migration:refresh

The problem is that if you have deleted a table at hand, you may have problems, because when you run the command above, it rolls down (Rollback) on all migrations and then executes the up .

    
13.09.2016 / 16:10