I need to move some columns from one existing table to another. How do I do it using a rails migration?
class AddPropertyToUser < ActiveRecord::Migration
def self.up
add_column :users, :someprop, :string
remove_column :profiles, :someprop
end
def self.down
add_column :profiles, :someprop, :string
remove_column :users, :someprop
end
end
The above just creates the new columns, but values are left empty...
I want to avoid logging in to the database to manually update the tables.
If there is a way to move column values programmatically, what are the performance characteristics? Would it do row-by-row, or is there a way to update in bulk?