Skip to content
/ yaml_db Public

Fork of yaml_db, but with different defaults and the ability to specify the dumpfile and individual tables.

Notifications You must be signed in to change notification settings

eadz/yaml_db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= YamlDb

YamlDb is a database-independent format for dumping and restoring data.  It complements the the database-independent schema format found in db/schema.rb.  The data is saved into db/[ENVIRONMENT].yml.

This can be used as a replacement for mysqldump or pg_dump, but only for the databases typically used by Rails apps.  Users, permissions, schemas, triggers, and other advanced database features are not supported - by design.

Any database that has an ActiveRecord adapter should work.

== Typical Usage

rake db:data:dump   ->   Dump contents of Rails database to db/development.yml
rake db:data:load   ->   Load contents of db/development.yml into the database
(Assuming current environment is development)

== Other Uses

rake db:data:dump DATAFILE=snapshot   -> Dump contents of Rails database to db/snapshot.yml
rake db:data:load RAILS_ENV=test      -> Loads the contents of db/test.yml into the database
rake db:data:dump TABLES=users,articles,comments  -> Dump contents of tables users, articles, and comments to db/development.yml

Further, there are tasks db:dump and db:load which do the entire database (the equivalent of running db:schema:dump followed by db:data:load).

== Examples

One common use would be to switch your data from one database backend to another.  For example, let's say you wanted to switch from SQLite to MySQL.  You might execute the following steps:

1. rake db:dump

2. Edit config/database.yml and change your adapter to mysql, set up database params

3. mysqladmin create [database name]

4. rake db:load

== Credits

YamlDb was created by Orion Henry and Adam Wiggins of Heroku.
Modified by Brandon Arbini of Sevenwire.

About

Fork of yaml_db, but with different defaults and the ability to specify the dumpfile and individual tables.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages