3

I am having trouble with running rake db:migrate and I get an error even after rake db:reset, and it says to run rake db:migrate and has the same error. What can I do to make it work and have the migration go through

SQLite3::SQLException: table "users" already exists: CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(255), "password_digest" varchar(255), "created_at" datetime, "updated_at" datetime) /Users/alextuazon/.rvm/gems/ruby-2.1.0/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `initialize'
/Users/alextuazon/.rvm/gems/ruby-2.1.0/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `new'
/Users/alextuazon/.rvm/gems/ruby-2.1.0/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:91:in `prepare'
/Users/alextuazon/.rvm/gems/ruby-2.1.0/gems/sqlite3-1.3.9/lib/sqlite3/database.rb:134:in `execute'
/Users/alextuazon/.rvm/gems/ruby-2.1.0/gems/activerecord-4.1.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `block in execute'

1 Answers1

0

Do a rake db:drop to drop the tables and then rake db:migrate to create them and all the other stuff your migrations do.

EDIT: Additionally, reading Difference between rake db:migrate db:reset and db:schema:load the answers to might be helpful

Community
  • 1
  • 1
Mark Silverberg
  • 1,249
  • 2
  • 8
  • 21
  • so would i have to do the whole migration process again? –  Jul 26 '14 at 00:40
  • @user3817684 Yes - if you dont want to run migrations and only restore to the schema, do: `db:reset` which according to the SO Q&A I linked to, "does db:drop, db:setup" – Mark Silverberg Jul 26 '14 at 00:41