What's a good way to clean up my migrations in Rails?

后端 未结 4 1618
梦如初夏
梦如初夏 2021-02-04 09:30

So I\'ve been working on this web app for a year now and I would like to compile to schema into ONE migration, that way my text editor loads faster, git working directory isn\'t

4条回答
  •  天命终不由人
    2021-02-04 09:57

    You don't need to keep your migrations around forever, you are free to delete them as soon as you're sure you don't need them anymore. Just go into your db/migrate/ directory and delete the migrations that are older than, say, a couple months.

    As long as all the migrations that you want to delete have been applied everywhere (i.e. development and production) then you don't need them anymore (unless you want to go backwards). Really, migrations aren't meant to be permanent files, they're just around to get you from A to B and then they're just baggage.

提交回复
热议问题