ruby - running rails migrations on production -
i have deployed rails app on vps passenger , nginx. have added migration following:
def change add_column :order_products, :order_id, :integer add_index :order_products, :order_id order.find_each |order| orderproduct.where(order_number: order.order_number).find_each |op| op.update_attributes!(order_id: order.id) end end end i executed rake db:migrate command on vps doesn't add column orderproduct table.
db/schema.rb contains following:
create_table "order_products", force: :cascade |t| t.string "order_number" t.string "item_code" t.integer "quantity" t.string "status" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "order_id" end add_index "order_products", ["order_id"], name: "index_order_products_on_order_id", using: :btree where there order_id column included. also, in schema_migrations table don't see latest migration version added.
do need else make work on production?
thanks help.
you need tell rake want run task in production environment:
$ rails_env=production rake db:migrate
Comments
Post a Comment