Best Practices for Incremental Seeds with Capistrano

别说谁变了你拦得住时间么 提交于 2019-12-25 12:09:13

问题


RoR 3.2.13 and 3.0.1 capistrano

My application requires initial data via rake db:seed. My continuous integration server does automatic deployment each time someone join a new feature and all test pass. Among the latest task is rake db:seed.

The first time works fine, but in the following fail the seeds because some records already exist in database.

Which strategy suggest me to run the seeds incrementally.

Note that:

  • The seeds may vary over time.
  • The application already contains data on production.
  • Should be run automatically from the Continuous Integration server.

Who should have the responsibility not to repeat information: Capistrano, the seed itself, the application, continuous integration server?


回答1:


In our team we are using migrations for change db schema and also existing data.




回答2:


The way for seeds is seed-fu. With seed-fu we can make idempotents seeds and means you can run sometimes without alter final result. the way for different seeds by environment or deploys is seedbank



来源:https://stackoverflow.com/questions/22767470/best-practices-for-incremental-seeds-with-capistrano

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!