File : README.md
Maintainer : Felix C. Stegerman <[email protected]>
Date : 2013-11-13
Copyright : Copyright (C) 2013 Felix C. Stegerman
Version : v0.0.2
Description
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:dumpcreates a yaml dumprake db:data:restorerestores a yaml dumprake db:data:deletedeletes all records in database
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 environmentFILE: the file to dump to/restore from (defaults todb/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, impliesVERBOSE)
Configuration files:
config/active-dump.yml: set defaultsconfig/database.yml: database connection
Examples
$ rake db:data:dump MODELS=Foo,Bar
$ RAILS_ENV=production rake db:data:load
$ rake db:data:restore DELETE=yes
$ rake db:data:delete # CAREFUL!
config/active-dump.yml:
file: db/dump.yml
verbose: true
models:
- 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
TODO
- specs! docs?
- use model's database connection?!
- ...
License
GPLv2 [1] or EPLv1 [2].
References
[1] GNU General Public License, version 2 --- http://www.opensource.org/licenses/GPL-2.0
[2] Eclipse Public License, version 1 --- http://www.opensource.org/licenses/EPL-1.0
