Rails plugin to generate SQL files from migrations
Latest commit 356e3bc Aug 22, 2012 1 @muness Merge pull request #3 from cldwalker/rails_root
use Rails.root for rails3
Failed to load latest commit information.
lib use Rails.root for rails3 Jun 15, 2012
MIT-LICENSE first commit Feb 19, 2009
README.rdoc No commit message Feb 20, 2009


Migration SQL Generator

This is a Rails plugin to generate SQL from migrations.

It achieves this by monkey patching the definitions of ActiveRecord::Base.connection.execute and other related methods.

It has only been tested with the sqlserver and mysql adapters (see limitations). If you test it with another adapter and it works, please let me know!


script/plugin install git://github.com/muness/migration_sql_generator.git


rake db:generate:migration_sql

Known limits

  • May fail on migrations that perform CRUD via ActiveRecord methods

  • With the mysql adapter, fails on change_column, rename_column

  • Fails on redhillonrails_core plugin with the mysql adapter


  • Muness Alrubaie, Relevance Inc.

Shout out to Jay Fields for the original code this plugin grew out of: blog.jayfields.com/2006/11/rails-generate-sql-from-migrations.html


Copyright Relevance, Inc. 2009

You may use, copy and redistribute this library under the MIT license.