Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

capistrano-db-tasks

> 编程语言
Open source

Add capistrano tasks for syncing remote and local database

371 stars0 likes1 views
WebsiteGitHub

About

Add capistrano tasks for syncing remote and local database

CapistranoDbTasks |

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

  • It only supports mysql and postgresql (both side remote and local)
  • Synchronize assets remote to local and local to remote

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.

Install

Add it as a gem:

ruby
gem "capistrano-db-tasks", require: false

Add to config/deploy.rb:

…

Add to .gitignore

yaml
/db/*.sql

How to install bzip2 on Windows

Available tasks

…

Example

Replace your local database with the production database

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.

bash
cap db:pull
cap production db:pull # if you are using capistrano-ext to have multistages

Replace your local database using a dump file stored on your machine

In 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)

Contributors

  • tilsammans (http://github.com/tilsammansee)
  • bigfive (http://github.com/bigfive)
  • jakemauer (http://github.com/jakemauer)
  • tjoneseng (http://github.com/tjoneseng)
  • numbata (http://github.com/numbata)
  • rafaelsales (http://github.com/rafaelsales)
  • rdeshpande (http://github.com/rdeshpande)

TODO

  • May be change project's name as it's not only database tasks now :)
  • Add tests

Copyright (c) 2009 [Sébastien Gruhier - XILINUS], released under the MIT license

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言