Dbserialize provides two rake tasks to store your current environments database
tables to Yaml fixtures in db/fixtures and to fill the database with these
fixtures.
That way it’s possible to store sample data consistently in the repository and
for all developers on a project to use common sample data instead of manually
generating something on every developer machine or sending database dumps around
via email.
Please read on the blog post.
You can easily add it to your rails project (from your rails app root)
git submodule add git://github.com/janv/dbserialize.git vendor/plugins/dbserialize
or get it from github through git
git clone git://github.com/janv/dbserialize.git vendor/plugins/dbserialize
You can keep it fresh with
git submodule init # or git submodule update
To save your database to Yaml call
rake db:serialize:save
To resore the database from the fixtures call
rake db:serialize:load
To only export certain tables, set the FIXTURES environment variable to a list
of table names seperated by commas:
FIXTURES="users,posts" rake db:serialize:sav
Copyright © 2007-2009 Jan Varwig, released under the MIT license