[ANN] Export Fixtures Plugin


#1

= Description

This plugin is a super lightweight tool used to export data into the
test/fixtures directory.

So if you want to export all your data from your production server into
your
development environment, this will simplify the process without having
to
load up your database manager.

[%] rake db:fixtures:export_all RAILS_ENV=development
[%] rake db:fixtures:load

= INSTALLATION

script/plugin discover
script/plugin install export_fixtures

= Usage

Create YAML test fixtures from data in an existing database. Defaults to
development database. Set RAILS_ENV to override.
rake db:fixtures:export_all

Create YAML test fixtures for a specific table(s) from data in an
existing
database. Defaults to development database. Set RAILS_ENV to override.

rake db:fixtures:export_for_tables TABLES=foo,bar

Create YAML text fixtures based on a specific SQL query
rake db:fixtures:export_using_query SQL=“select * from foo where
id=‘bar’”
FIXTURE_NAME=foo

= BUGS

Please report any bugs or feature enhancements to
http://dev.toolbocks.com

Nathaniel S. H. Brown                        http://nshb.net

#2

Nathaniel, is my interpretation right that your data dumper just exports
tables ? (while other approaches, for example the one of topfunky
exported
objects and had trouble with habtms relations).


#3

It’s just a slightly more advanced version of the code in Rails
Recipes for this task. It allows you to specify specific tables or
use a sql query to specify the data.

Thanks to Nathaniel for turning it into a plugin.

Cheers,

Chris


#4

This plugin is actually the brainchild of Chris McGrath. I did some
tweaking
to add namespace support, but the seed was sewn by Chris and I had the
privlege to package it all up and throw it on my open source repository
(dev.toolbocks.com).

The topfunky script I had checked out was indeed exporting ruby objects,
which I had some errors with when I tried it. I did some hacking and
couldn’t get to the bottom of it.

The Export Fixtures plugin is completely lightweight, and doesn’t add
anything to ActiveRecord class as the ar_fixtures plugin does. It is
simply
a rake task, which exports the data in the database into a flat YAML
file,
not as ruby objects.

-Nb

On 3/30/06 6:20 AM, “Roberto S.” removed_email_address@domain.invalid wrote:

Nathaniel, is my interpretation right that your data dumper just exports
tables ? (while other approaches, for example the one of topfunky exported
objects and had trouble with habtms relations).


Roberto S. - http://rsaccon.com


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Nathaniel S. H. Brown                        http://nshb.net