LoginSignup
0
0

More than 1 year has passed since last update.

column does not exist

Posted at

このようなエラーメッセージが出ました。
スクリーンショット 2021-07-06 17.50.39.png

family_name_kanaが存在しないと仰ってます。familyname_kanaが関係しているのではないかとも仰ってます。

とりあえずmigrationファイルを確認。

20257608489764_create_customer.rb
class CreateCustomers < ActiveRecord::Migration[6.0]
  def change
    create_table :customers do |t|
      t.string :email, null: false
      t.string :family_name, null: false
      t.string :given_name , null: false
      t.string :familyname_kana, null: false
      t.string :given_name_kana, null: false
      t.string :gender 
      t.date :birthday
      t.string :hashed_password

      t.timestamps
    end

      add_index :customers, "LOWER(email)" ,unique: true
      add_index :customers, [ :family_name_kana, :given_name_kana]

  end
end
20257608489764_create_customer.rb
class CreateCustomers < ActiveRecord::Migration[6.0]
  def change
    create_table :customers do |t|
      t.string :email, null: false
      t.string :family_name, null: false
      t.string :given_name , null: false
      t.string :family_name_kana, null: false   #<=修正
      t.string :given_name_kana, null: false
      t.string :gender 
      t.date :birthday
      t.string :hashed_password

      t.timestamps
    end

      add_index :customers, "LOWER(email)" ,unique: true
      add_index :customers, [ :family_name_kana, :given_name_kana]

  end
end

修正して rails db:resetコマンドを入力するも、解消せず。同様のエラーメッセージが。

vscodeの検索窓でfamilyname_kanaを入力。複数のファイルが引っかかったのですべて修正して再びresetコマンドを入力。無事に解消しました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0