migrations: getting SQL output only?

Check out this…

http://www.agilewebdevelopment.com/plugins/activerecord_io_mode_plugin

I think that should help you…

Mark

This looks like it is generally useful in certain cases, but would probably be very difficult to implement for my needs. If I understand

the little synopsis correctly, I would have to modify every call to an activerecord object that generates a database query.

Not true, all you need to do is…

output_sql =

ActiveRecord:: Base.send_sql_to output_sql #do all the migrations

Now the array output_sql will have all the generated sql in it, and nothing will have hit the db. In fact, you can also make output_sql a file instead of an array. You just need to put this at the begining of the the migrations. Let me know if you need a more concrete example and ill see what i can get together tonight.

mark

Not entirely what you're asking for, but I'm about to write a rails backend ui to manage a database used by a mod_perl frontend. mod_perl relies on a load of constraints, grants, etc that are hard to capture with migrations.

I found Robbys page on using raw SQL in migrations to be a good match for what I need:

http://www.robbyonrails.com:8680/articles/2005/11/11/rails-migrations-and-postgresql-constraints

You'd still need ruby and activerecord, but that's not a big deal in my case.