rails g migration add_image_name_to_usersを実行し、usersテーブルに、image_nameカラムを追加したいのですが、
日付_add_image_name_to_users.rbにadd_column :users, :image_name, :stringと変更内容を記述し、
rake db:migratedeを実行した後、schema.rbを見るとimage_nameカラムが追加されていません。
progateというサイトのコードをそのままcloud9で実行しているんですが、バージョンの違いなどが原因となることはあるでしょうか?(バージョンの違いがどれほど動作に影響するのかわかりませんが、、、)
railsのバージョンがそれぞれ、progateは5.0.3でcloud9は4.2.5です。
(ですので、cloud9でrails db:migrateは使えません。)
それとも他の原因が考えられますか?
schema.rb
1ActiveRecord::Schema.define(version: 20170828044627) do 2 3 create_table "posts", force: :cascade do |t| 4 t.text "content" 5 t.datetime "created_at", null: false 6 t.datetime "updated_at", null: false 7 end 8 9 create_table "users", force: :cascade do |t| 10 t.string "name" 11 t.string "email" 12 t.datetime "created_at", null: false 13 t.datetime "updated_at", null: false 14 end 15 16end 17
class AddImageNameToUsers < ActiveRecord::Migration def change add_column :users, :image_name, :string end end
回答1件
あなたの回答
tips
プレビュー