L11
L11

Reputation: 187

Error in migration

I tried to run db migration and I got the following error

PG::UndefinedTable: ERROR:  relation "authie_sessions" does not exist

: ALTER TABLE "authie_sessions" ADD "two_factored_at" timestamp/home/levi/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `async_exec'

My migration file is

class AddTwoFactorAuthFieldsToAuthie < ActiveRecord::Migration[4.2]
  def change
    add_column :authie_sessions, :two_factored_at, :datetime
    add_column :authie_sessions, :two_factored_ip, :string
    add_column :authie_sessions, :requests, :integer, :default => 0
    add_column :authie_sessions, :password_seen_at, :datetime
  end
end

My database.yml is

default: &default
  adapter: postgresql
  encoding: utf8
  pool: 5
  username: postgres
  password: postgres
  database: staytus
  host: 127.0.0.1

production:
  <<: *default

development:
  <<: *default

test:
  <<: *default
  database: staytus_test

I am using postgresql

Upvotes: 1

Views: 99

Answers (1)

Check authie_sessions table exists in both databases staytus and staytus_test.

Upvotes: 1

Related Questions