Error :: StandardError: An error has occurred, this and all later migrations canceled: SQLite3::SQLException: table "users" already exists

Error ::

StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: table "users" already exists


................................................................................................................................................

9

just run into the console

rails console

and type in

ActiveRecord::Migration.drop_table(:users)

and then exit the console and

rake db:migrate


This method is successful ::

this will work definately



51

If you create an empty migration by running:
rails g migration DropInstalls
or:
rails generate migration DropInstalls

You can then add this into that empty migration:

class DropInstalls < ActiveRecord::Migration
  def change
    drop_table :installs
  end
end

Then run rake db:migrate in the command line which should remove the Installs table

Note: db/schema.rb is an autogenerated file. To alter the db structure, you should use the migrations instead of attempting to edit the schema file.




Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5