Forum: Ruby on Rails [ANN] Export Fixtures Plugin

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nshbrown N. (Guest)
on 2006-03-30 15:46
(Received via mailing list)
= 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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Roberto S. (Guest)
on 2006-03-30 18:22
(Received via mailing list)
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).
Nshbrown N. (Guest)
on 2006-03-31 00:20
(Received via mailing list)
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris McGrath (Guest)
on 2006-03-31 02:44
(Received via mailing list)
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
This topic is locked and can not be replied to.