charlie26
charlie26

Reputation: 21

SQLite3::SQLException: no such table:"

I am trying to run migrations rails:db:migrate, but i keep getting this error:

Caused by: SQLite3::SQLException: no such table: buyers

This is the migration which causes the error, because i deleted Buyer Table before:

class AddUserToBuyers < ActiveRecord::Migration[5.1]
  def change
   add_reference :buyers, :user, foreign_key: true
  end
end

How can i delete this migration file now that Buyer Table doesn't exist anymore? So i will be able to run my new migrations. Thanks

Upvotes: 0

Views: 1363

Answers (1)

charlie26
charlie26

Reputation: 21

In my case, i was able to solve this by running:

    rails db:reset

Deleted the migrations files referencing buyer table . then do:

    rails db:migrate

Hope this helps anyone else with the same issue.

Upvotes: 2

Related Questions