Support the ongoing development of Laravel.io →
Database
Last updated 3 months ago.
0

What do you mean "ruins old tables"? What happens to them? What errors do you get?

Laravel migrations run in the order they were created - php artisan migrate will run any migrations which have not yet been run, so I don't know why this should be ruining your tables.

There are ways to run only one migration but I wouldn't recommend messing around with your migrations this way, since the point of them is to be able to rollback safely if you need to, and stuffing around with them manually may destroy this ability, and may make you lose data.

It may be prudent to go through each of your migration files and make sure the code is ok in them. Once you are sure you could run:

php artisan migrate:reset

and start again. (Or simply run php artisan migrate:refresh)

Having said that, depending how much data is at stake here you could simply:

  • backup your current migrations directory
  • delete the current migrations table
  • reestablish your migrations one by one, thoroughly testing the migrate/rollback functionality of each one at a time

HTH, Gary

Last updated 3 months ago.
0

I have been run old tables and everything went as it should. I created new table and i run new migration and it started to run old tables, which already was created. I can't reset database because i have some data already.

Last updated 3 months ago.
0

Copy your migration file to a temporal folder "temp" in migrations folder, then run (paths as in L5):

php artisan migrate --path=database/migrations/temp

This way it will only run that file without messing with your current tables.

Last updated 7 years ago.
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Stol3x Stol3x stol3x Joined 18 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.