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
|
||||
+3
-2
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130902164600) do
|
||||
ActiveRecord::Schema.define(:version => 20130902201853) do
|
||||
|
||||
create_table "bike_actions", :force => true do |t|
|
||||
t.string "action", :limit => 128, :null => false
|
||||
@@ -49,7 +49,7 @@ ActiveRecord::Schema.define(:version => 20130902164600) do
|
||||
create_table "bikes", :force => true do |t|
|
||||
t.string "serial_number"
|
||||
t.integer "bike_brand_id", :null => false
|
||||
t.integer "bike_model_id", :null => false
|
||||
t.integer "bike_model_id"
|
||||
t.string "color"
|
||||
t.integer "bike_style_id", :null => false
|
||||
t.float "seat_tube_height"
|
||||
@@ -61,6 +61,7 @@ ActiveRecord::Schema.define(:version => 20130902164600) do
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "shop_id"
|
||||
t.string "model"
|
||||
end
|
||||
|
||||
add_index "bikes", ["shop_id"], :name => "index_bikes_on_shop_id", :unique => true
|
||||
|
||||
Reference in New Issue
Block a user