テーブルに新たにカラムを加えたいのですが、うまくいきません。
カラムの追加を行うため、以下のファイルを作成しました。
class AddImageNameToUsers < ActiveRecord::Migration[5.2] def change add_column :users, :image_name, :string end end
続いて、コンソールにて以下のコマンドを実行しました。
rails db:migrate:status
コマンドの実行により、以下の結果を得ました。
Status Migration ID Migration Name -------------------------------------------------- up 20190328234450 Create posts up 20190329103845 Create users up 20190329230353 Add image name to users
しかし、db\schema.rbを確認すると、image_nameが追加されていませんでした。
ActiveRecord::Schema.define(version: 2019_03_29_230353) do create_table "posts", force: :cascade do |t| t.text "content" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "users", force: :cascade do |t| t.string "name" t.string "email" t.datetime "created_at", null: false t.datetime "updated_at", null: false end end
ご教授のほど、よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/30 00:01
2019/03/30 00:04
2019/03/30 01:39
2019/03/30 01:48