17 lines
533 B
Ruby
17 lines
533 B
Ruby
class ChangeProductUpgradesRelationships < ActiveRecord::Migration
|
|
def self.up
|
|
change_table :product_upgrades do |t|
|
|
t.remove :product_id
|
|
t.integer :upgradable_id, :references => nil
|
|
t.integer :upgradable_to_id, :references => nil
|
|
t.string :upgradable_type, :default => 'ProductEdition'
|
|
t.string :upgradable_to_type
|
|
end
|
|
ProductUpgrade.update_all(["upgradable_id = product_edition_id"])
|
|
remove_column :product_upgrades, :product_edition_id
|
|
end
|
|
|
|
def self.down
|
|
end
|
|
end
|