我创建了一个名为AddEntryTOMembers entry:decimal
的迁移。然后我需要将小数更改为整数。当我运行rake db:rollback
时,它已成功回滚,但当我重新运行rails g AddEntryTOMembers entry:integer
时,它显示:
SQLite3::SQLException: duplicate column name: entry: ALTER TABLE "members" ADD "
entry" integerc:/Sites/roomapp/db/migrate/20150216143625_add_entry_to_members.rb
:3:in `change'
c:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
然后我在Stack Overflow上搜索并找到" SQLite3::SQLException: duplicate column name while migrating"。之后我跑了rake db:migrate VERSION=0
它回滚了所有的迁移。
但是当我再次运行rake db:migrate
时,它显示我之前成功添加迁移的问题。
SQLite3::SQLException: duplicate column name: image: ALTER TABLE "members" ADD "
image" varcharc:/Sites/roomapp/db/migrate/20150206144138_add_image_to_members.rb
:3:in `change'
c:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
如何重新迁移所有迁移?