Project

dbmgr

0.03
No commit activity in last 3 years
No release in over 3 years
Create database backups to share with others across your dev team. Other developers can restore from backups you've created.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 5.0
~> 1.2
~> 0.4.5
~> 0.18.2
~> 10.0

Runtime

~> 0
 Project Readme

Dbmgr

Build Status

dbmgr is a command line tool for backing up and restoring databases. It's a useful tool for:

  • Backing up and restoring your development databases
  • Sharing databases between developers
  • Provisioning new Vagrant VMs and Docker images
  • Provisioning new developers with a working database

Installation

$ brew tap callahanrts/dbmgr
$ brew install dbmgr

or

$ gem install dbmgr

Usage

dbmgr [dbms] [action] --options-list

DBMSs

  • MySQL (mysql)
  • PostgreSQL (psql)

Backup

Back up a database

# Back up database from local server
dbmgr [dbms] backup database_name

# Back up database from a remote server
dbmgr [dbms] backup database_name -P 3307 -h 192.168.33.10 -u root

# Back up database and store in a specific location
dbmgr [dbms] backup database_name -p ~/Downloads

# Back up database as a named backup
dbmgr [dbms] backup database_name -f my_backup.sql

Restore

Restore a MySQL database

# Restore local database from the latest backup in the default location
dbmgr [dbms] restore database_name

# Restore remote database with the latest backup
dbmgr [dbms] restore database_name -P 3307 -h 192.168.33.10 -u root

# Restore local database from the latest backup in a specific location
dbmgr [dbms] restore database_name -p ~/Downloads

# Restore database from a named backup
dbmgr [dbms] restore database_name -f my_backup.sql

Help

dbmgr help
dbmgr help mysql
dbmgr mysql help backup
dbmgr psql help backup
...

Tips

Add a function in your ~/.bashrc to back up a specific database so you don't have to type out all of the options each time.

function dbbackup(){
  dbmgr mysql backup mydb_dev -P 3306 -h 192.168.99.100
}

function dbrestore() {
  dbmgr mysql restore mydb_dev -P 3306 -h 192.168.99.100
}

Contributing

Build the Gem

gem build dbmgr.gemspec

Install the Built Gem

gem install ./dbmgr-x.x.x.gem