Rails5.1.7で学習をしています。
$ rails s -e production で起動すると以下のようなエラーが出ます。
[vagrant@localhost edamame]$ rails s -e production => Booting Puma => Rails 5.1.6 application starting in production => Run `rails server -h` for more startup options Exiting /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.10/lib/mysql2/client.rb:120:in `_query': Mysql2::Error: Table 'edamame_production.customers' doesn't exist: SHOW FULL FIELDS FROM `customers` (ActiveRecord::StatementInvalid)
customersテーブルがおかしいと言われているような感じです。
class CreateCustomers < ActiveRecord::Migration[5.1] def change create_table :customers do |t| t.string :email, null: false #メールアドレス t.string :email_for_index, 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 :nick_name, null: false t.string :hashed_password t.timestamps end add_index :customers, :email_for_index, unique: true add_index :customers, :nick_name, unique: true add_index :customers, [ :family_name_kana, :given_name_kana ] end end
やってみたこと
class CreateCustomers < ActiveRecord::Migration[5.1] を
class CreateCustomers < ActiveRecord::Migration[5.0] にして
migrateしてみましたが変化はありませんでした。
開発環境では問題無く動作しています。
どなたか解決方法の教授よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー