mirror of
https://github.com/fspc/BikeShed-1.git
synced 2026-09-16 08:31:36 -04:00
Moving bike model to the bikes table
Leaving the bike_models table and bikes.bike_model_id column as a backup.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
class AddModelToBike < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :bikes, :model, :string
|
||||
change_column :bikes, :bike_model_id, :integer, :null => true
|
||||
Bike.all.each do |bike|
|
||||
bike.model = BikeModel.find_by_id(bike.bike_model_id).model
|
||||
bike.save
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user