PG: ERROR: relation "admin_users" does not exist
I am currently getting the following error when I run heroku logs, after trying to login to the admin/login part of my production URL:
ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation “admin_users" does not exist
I have tried followed this thread :https://github.com/gregbell/active_admin/issues/753, i.e. specifically the following suggested steps (suggested to be performed on a "new install" which I am unclear what that means!)
rails g active_admin:devise
rails g active_admin:install
(If install fails because of #2414, remove duplicate ActiveAdmin.routes(self) from routes file, then run rails g active_admin:assets) remove add_devise_to_admin_users migration file
I have done the above steps w/o adhering to the "new install" portion but am still getting the same error.
Here is the copy of my database.yml file:
# SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' development: adapter: postgresql database: myapp_development pool: 5 timeout: 5000 password: # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: postgresql encoding: unicode database: myapp_test pool: 5 timeout: 5000 password: production: adapter: postgresql database: myapp_production username: password: pool: 5 timeout: 5000
Here is the copy of my Gemfile
source 'https://rubygems.org' ruby "2.1.1" gem 'rails', '4.0.4' gem 'sass-rails', '~> 4.0.2' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 1.2' group :doc do # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', require: false end gem 'activeadmin', github: 'gregbell/active_admin' group :production do gem 'pg' gem 'rails_12factor' end
After you push your code to Heroku via git, switch to your project root and run:
$ heroku run rake db:migrate
This will run rake db:migrate on your production server.