我是 Rails 的新手,也是 cequel 的新手。我有现有的模型女巫是在 Postgres 上生成的,现在我正试图将它迁移到 Cassandra。1. 我只想迁移我的一个模型,而另一个我想留在 Postgres 上。这可能吗?
我的模型:
class TripPoint
include Cequel::Record
belongs_to :trip
key :device_created_at, :timestamp
key :trip_points_id, :timeuuid, auto: true
column :rssi, :int
....
end
class Trip < ActiveRecord::Base
has_many :trip_points
end
当我尝试运行时: rake cequel:migrate 我收到错误消息:
rake aborted!
NoMethodError: undefined method `key_columns' for #<Class:0x00000007863dd0>
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.10/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/associations.rb:117:in `belongs_to'
/home/zmagajna/Ruby/ULU/ulu-rails/app/models/trip_point.rb:10:in `<class:TripPoint>'
/home/zmagajna/Ruby/ULU/ulu-rails/app/models/trip_point.rb:1:in `<top (required)>'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:443:in `load'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:443:in `block in load_file'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:633:in `new_constants_in'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:442:in `load_file'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:342:in `require_or_load'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:307:in `depend_on'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.10/lib/active_support/dependencies.rb:225:in `require_dependency'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:61:in `block in migrate'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:55:in `each'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:55:in `migrate'
/home/zmagajna/.rvm/gems/ruby-2.1.2/gems/cequel-1.7.0/lib/cequel/record/tasks.rb:21:in `block (2 levels) in <top (required)>'
/home/zmagajna/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/home/zmagajna/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => cequel:migrate
(See full trace by running task with --trace)
我的环境:ruby 2.1.2p95 Rails 4.1.10 cequel (= 1.7.0)