Skip to content

Instantly share code, notes, and snippets.

@libryder
Created November 12, 2011 19:53
Show Gist options
  • Save libryder/1361017 to your computer and use it in GitHub Desktop.
Save libryder/1361017 to your computer and use it in GitHub Desktop.
Migration example to rename column
# It's recommended to change the class and filename to be a little more descriptive for your environment
class RenameTableColumn < ActiveRecord::Migration
def up
rename_column :table_name, :producthistory_id, :product_history_id
end
def down
rename_column :table_name, :product_history_id, :producthistory_id
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment