我重新安装了回形针gem,但在尝试运行迁移时遇到错误。 (注意:我只从文本编辑器中删除了原始的迁移文件)。具体来说,当我跑:
$ rake db:migrate
我遇到了:
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: duplicate column name: image_file_name: ALTER TABLE "pins" ADD "image_file_name" varchar
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:4:in `block in up'
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:3:in `up'
c:in `migrate'
ActiveRecord::StatementInvalid: SQLite3::SQLException: duplicate column name: image_file_name: ALTER TABLE "pins" ADD "image_file_name" varchar
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:4:in `block in up'
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:3:in `up'
c:in `migrate'
SQLite3::SQLException: duplicate column name: image_file_name
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:4:in `block in up'
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:3:in `up'
c:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
看到上述内容后,我尝试运行rake db:drop
,但遇到了:
Permission denied @ unlink_internal
有人可以建议如何解决这个问题吗? (注意:我使用的是Windows 8,rails 4.2.5.1,paperclip 4.3.7) 欣赏很多!
答案 0 :(得分:0)
删除development.sqlite3文件并重新运行db:migrate解决了问题!
答案 1 :(得分:0)
检查是否关闭Rails服务器以运行rake db:drop。我遇到了同样的问题,然后你重新安装了papperclip。我希望我帮助过。