active-dump - dump and restore activerecord from/to yaml
Latest commit e698b4d Aug 12, 2014 @obfusk v0.2.3
Failed to load latest commit information.
lib v0.2.3 Aug 12, 2014
.gitignore looks good Nov 13, 2013
.yardopts looks good Nov 13, 2013 v0.2.3 Aug 12, 2014
Rakefile looks good Nov 13, 2013
active-dump.gemspec fix: rails engines api change; update license Aug 12, 2014

File        :
Maintainer  : Felix C. Stegerman <>
Date        : 2014-08-12

Copyright   : Copyright (C) 2014  Felix C. Stegerman
Version     : v0.2.3

Gem Version


active-dump - dump and restore activerecord from/to yaml

active-dump provides 3 rake tasks that allow you to dump and restore activerecord data from/to yaml:

  • rake db:data:dump creates a yaml dump
  • rake db:data:restore restores a yaml dump
  • rake db:data:delete deletes all records in database
  • rake db:data:fix_seqs fixes (postgresql) sequences

NB: active-dump does not take migrations (or validations etc.) into account -- it dumps and restores raw data from the ActiveRecord models -- so make sure your migrations are in sync.

When using rails, add this to your Gemfile:

gem 'active-dump', require: 'active-dump/rails'

You can use these environment variables to configure active-dump:

  • RAILS_ENV: the environment
  • FILE: the file to dump to/restore from (defaults to db/data.yml)
  • MODELS: the models to dump (defaults to all models)
  • DELETE: delete records with same id before restore (defaults to false)
  • VERBOSE: print info/sql (defaults to false)
  • DRYRUN: don't do anything (defaults to false, implies VERBOSE)

Configuration files:

  • config/active-dump.yml: set defaults
  • config/database.yml: database connection


$ rake db:data:dump MODELS=Foo,Bar
$ RAILS_ENV=production rake db:data:restore
$ rake db:data:restore DELETE=yes
$ rake db:data:delete   # CAREFUL!


file: db/dump.yml
verbose: true
  - Cms::Block
  - Cms::Categorization
  - Cms::Category
  - Cms::File
  - Cms::Layout
  - Cms::Page
  - Cms::Revision
  - Cms::Site
  - Cms::Snippet

Specs & Docs

$ rake spec   # TODO
$ rake docs


  • specs! docs?
  • use model's database connection?!
  • ...


LGPLv3+ [1].


[1] GNU Lesser General Public License, version 3 ---