我在运行rake db:migrate时出现问题,即使在rake db:reset之后我也收到错误,并且它说运行rake db:migrate并且具有相同的错误。我该怎么做才能让它发挥作用并进行迁移
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'
答案 0 :(得分:0)
执行rake db:drop
删除表格,然后rake db:migrate
创建它们以及迁移所做的所有其他内容。
编辑:另外,阅读Difference between rake db:migrate db:reset and db:schema:load答案可能会有所帮助