为同步远程和本地数据库添加 capistrano 任务
Add database AND assets tasks to capistrano to a Rails project. It only works with capistrano 3. Older versions until 0.3 works with capistrano 2.
Currently
Commands mysql, mysqldump (or pg_dump, psql), bzip2 and unbzip2 (or gzip) must be in your PATH
Feel free to fork and to add more database support or new tasks.
Add it as a gem:
gem "capistrano-db-tasks", require: falseAdd to config/deploy.rb:
…Add to .gitignore
/db/*.sqlHow to install bzip2 on Windows
…This use case allows you to have the same data on your machine as your production. You then can reproduce or test things before to apply to your production.
cap db:pull
cap production db:pull # if you are using capistrano-ext to have multistagesIn case you have a dump file on your machine (you used db:pull and kept some files)
and you want to replay one of them, you can use the db:local:load:
cap development db:local:load DUMP_FILE=db/myapp_production_2018-01-10-150434.sql(You have to create a config/deploy/development.rb file containing
set :stage, :development at least in order to get this working)
Copyright (c) 2009 [Sébastien Gruhier - XILINUS], released under the MIT license
暂无开放 Issues,或尚未同步最近议题。