Railsでrails db:migrateしようとしたら「ActiveRecord::NoEnvironmentInSchemaError」と怒られた。
Rails db:migrateを実行すると以下のようなエラーが起きた。
aborted! ActiveRecord::NoEnvironmentInSchemaError: Environment data not found in the schema. To resolve this issue, run: bin/rails db:environment:set RAILS_ENV=development /usr/local/bundle/gems/activerecord-5.2.6.2/lib/active_record/migration.rb:1135:in `last_stored_environment' /usr/local/bundle/gems/activerecord-5.2.6.2/lib/active_record/tasks/database_tasks.rb:58:in `check_protected_environments! ... <|| どうやらdbをtest,development,productionのどの環境で実行するか指定していなかったようだ。 言われたとおりに >|| bin/rails db:environment:set RAILS_ENV=development
を実行すると動いた。