class RenameLinkTemplateElementsToSubtemplates < ActiveRecord::Migration
def self.up
rename_column :template_elements, :template_id, :sub_template_id
TemplateElement.reset_column_information()
end
def self.down
rename_column :template_elements, :sub_template_id, :template_id
TemplateElement.reset_column_information()
end
end
|
|
|||||||
Ruby on Rails migration on empty DB with renaming/adding/removing columns in the middle
if you do rename_column/add/remove in your migration, don't forget to call reset_column_information in the changed class. Otherwise you may have a problem with running migration on an empty DB if you pre-seed data in the migration after change
Example:
Comments
No comments found.
Trackbacks
TrackBack URL: |
|||||||
|
|
|||||||