Nothing to migrate

Asked

Viewed 2,205 times

0

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

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

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

2 answers

1

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

php artisan migration:refresh --seed  

He will roll back his bank and recreate the bank.

Documentation: link;

1

When you run a Migration on Laravel, all records are recorded (by default) in the table migrations. It contains the information of which Migrations were executed.

If you delete the table "in 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-export all Migrations.

php artisan migration:refresh

The problem is that if you have deleted a table in your hand, you may have problems, because when you execute the above command, it runs down (Rollback) on all Migrations to then run the up.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.