【发布时间】:2011-10-09 06:00:30
【问题描述】:
我有一张名为profiles 的表,其中包含一些列。
现在我希望使用 rails 3.1 中的change-方法向该表添加几列。我使用以下代码创建了一个迁移:
def change
change_table :profiles do |t|
t.string :photo
t.string :name
t.references :user
end
end
迁移工作完美,但是当我想回滚时,我得到了
SQLite3::SQLException: duplicate column name: photo: ALTER TABLE "profiles" ADD "photo" varchar(255)
有什么想法吗?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3.1