前提・実現したいこと
sorceryでログイン機能を実装しようとしたところ、
タイトルにあるようなエラーが発生しました。
この記事を参考にしてraile db:migrateまで行いました。
発生している問題・エラーメッセージ
$ rake db:migrate == 20210920044052 AddOmniauthToUsers: migrating =============================== -- add_column(:users, :provider, :string) rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::UndefinedTable: ERROR: relation "users" does not exist /Library/Ruby/Gems/2.6.0/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `exec' /Library/Ruby/Gems/2.6.0/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `async_exec' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block (2 levels) in execute' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `block in execute' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log' /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:45:in `execute' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:611:in `add_column' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:398:in `add_column' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:929:in `block in method_missing' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `block in say_with_time' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `say_with_time' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:918:in `method_missing' /Users/adachinana/login/db/migrate/20210920044052_add_omniauth_to_users.rb:3:in `change' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:867:in `exec_migration' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:851:in `block (2 levels) in migrate' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:850:in `block in migrate' /Library/Ruby/Gems/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection' Caused by: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "users" does not exist ・ ・ ・ /Library/Ruby/Gems/2.6.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>' Tasks: TOP => db:migrate (See full trace by running task with --trace)
試したこと
$ rake db:migrate:status database: login_development Status Migration ID Migration Name -------------------------------------------------- down 20210920044052 Add omniauth to users down 20210920051530 Sorcery core
といった状況であったために、
rake db:migrate VERSION=20210920051530
を試してみましたが、解決できませんでした。
補足情報(FW/ツールのバージョンなど)
ruby 2.6.3
Rails 6.1.4.1
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/09/22 01:48