如何保留旧的迁移作为参考?

  • I have 38 migration script that I wrote in Laravel 4.

enter image description here

  • I don't want to throw them away, but I also don't want to run them either. I just want to keep them as references.
  • If I place them in the migration folder in Laravel, it will run when I do

php artisan migrate and that will break some part of my database, as they have already been run.

  • I'm wondering if there is a way to mark them as already run, so Laravel will not trying to run them again.

  • I notice the migration table in my database - can I do something with it ?

What is the best way I should do to those 38 migrations ? Feel free to give me any suggestions.

Your question is a little confusing -- Laravel will only run each migration once. It keeps track of which migrations have run in the migrations table. The whole idea of migrations is a series of date sortable scripts that you can run at anytime start to finish and they rebuild your database, AND that you can add to without needing to rerun them all as they work (so your data is preserved)

If you're running

php artisan migrate

and Laravel's running a migration it has already run, something is very broken with your system.

(Speculation follows) It seems more likely the latest migration you're running may have halted half way though in a place MySQL couldn't rollback the changes, and Laravel's trying to rerun the latest one. Try a

php artisan migrate:rollback

Fix the error in the breaking migration, and you'll be all set.