views:

29

answers:

1

I've seen http://github.com/muness/migration_sql_generator, but it doesn't work properly with MySQL for certain important operations. Is there any other way we can capture the sql generated during a rails migration?

The reason I'm asking is that I cannot run the migrations on the production server since it is maintained by technical support (and never touched by developers) at my company. Developers provide a JRuby on Rails war file to tech support and they deploy it via Tomcat. But convincing tech support to install JRuby and Rails just to run the migrations on production is definitely not going to be easy. We want to keep the deployment really simple and with as few dependencies as possible.

We want to simply provide them with a war file and a sql script with db changes.

+1  A: 

You may be able to use some kind of tool to generate a diff of two databases. There's a question on that here.

If you diff your test database with your development database just after running the migration that would probably be the easiest way. It might even be worth adding a rake task to do it; get that rake task to depend on the migration and then you could use the new task instead of rake db:migrate to generate a diff each time you migrate.

Shadwell
the diff should be done on table structure for every table, and data for schema_migrations since you want to have the migrations in this table.
hellvinz