Skip to content

Instantly share code, notes, and snippets.

@jgn
Created June 7, 2012 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgn/2887365 to your computer and use it in GitHub Desktop.
Save jgn/2887365 to your computer and use it in GitHub Desktop.
Generate migration code for single table based on current state of the database
ActiveRecord::SchemaDumper.ignore_tables = ActiveRecord::Base.connection.tables - ['table_name']
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, $stdout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment