Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.39 KB

README.rdoc

File metadata and controls

43 lines (25 loc) · 1.39 KB

git friendly dumper

Use fixtures to create a db independent and git friendly db dump.

It’s git friendly because each record is in its own file (git doesn’t do very well with large files that are committed all at once).

If using the schema option (ie. db:dump & db:load), then each table’s schema definition is included as is the schema_migrations table.

Example usage:

# drop-in replacement for mysqldump

  rake db:dump DUMP_PATH=some/path
  # just like mysqldump -u <user> -p<pass> <app>_development > some/path.sql

  rake db:load DUMP_PATH=some/path
  # just like script/dbconsole -p < some/path.sql

# without schema information, just the data

  rake db:data:dump DUMP_PATH=some/path # dump the data without touching the structure
  rale db:data:load DUMP_PATH=some/path # load the data without touching the structure

# just load particular table data

  rake db:data:load DUMP_PATH=some/path TABLES=users,things

Notes

It’s probably a bad idea to check your dump into the same repo as your app.

I created this so that we could have incremental scheduled backups of the db. With a database of 120M containing many binary columns, this resulted in a massive saving in bandwidth.

Basically, we have the db backup inside the app, but ignored by the main app, the db/dump has it’s own git repo.

It’s tested against master (2.3) and 2-2-stable branches