doue9730 2015-02-06 13:41 采纳率: 100%
浏览 6
已采纳

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

  • 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.

  • 写回答

1条回答 默认 最新

  • dongshang1934 2015-02-06 15:16
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分