我正在尝试安装 Ancestry gem,但我遇到了rake db:migrate
.
我正在按照 Ancestry github 页面上的说明进行操作。完成后,我rails g migration add_ancestry_to_message ancestry:string
将迁移文件(在 railcast #262 之后)编辑为:
class AddAncestryToMessage < ActiveRecord::Migration
def self.up
add_column :messages, :ancestry, :string
add_index :messages, :ancestry
end
def self.down
remove_index :messages, :ancestry
remove_column :messages, :ancestry
end
end
当我然后运行rake db:migrate
时,我收到以下错误:
== AddAncestryToMessage: migrating ===========================================
-- add_column(:messages, :ancestry, :string)
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such table: Shipmgr: ALTER TABLE "Message" ADD "ancestry" varchar(255)
Tasks: TOP => db:migrate
我已经在新创建的 Rails 应用程序和现有的 Rails 应用程序上尝试过这个,但我仍然无法让它工作。有人对这个问题有什么建议吗?