我正在尝试学习Ruby,到目前为止已经过了几天,但最终真的坚持这个错误信息:
$ rake db:migrate
==CreatePins: migrating =====
--create_table<:pins>
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "pins" already exists: CREATE TABLE "pins" <"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "description" varchar<255>, "created_at" datetime, "updated_at" datetime> C:/users/xxx/xxx/xxx/xxx/xxx/xxx/##########_create_pins.rb:3:in 'change'
c:in 'migrate'
Tasks: TOP => db:migrate
<See full trace by running task with --trace>
我尝试过rake db:rollback,rake db:rollback STEP = 2,进入单个文件并消除任何与引脚/引脚表有任何相似之处。也许我用git push或push heroku做错了?想法?
答案 0 :(得分:2)
尝试 rake db:reset 我希望它为你工作。如果它不起作用,你有2个迁移文件用于相同的表引脚删除任何人并再次运行 rake db:reset
答案 1 :(得分:0)
我遇到了同样的问题,我通过在create_pins.rb添加“drop_table:pins”来解决这个问题