Class: ROM::Cassandra::Migrations::Migration
- Inherits:
-
Object
- Object
- ROM::Cassandra::Migrations::Migration
- Defined in:
- lib/rom/cassandra/migrations/migration.rb
Overview
Base class for migrations, responcible for sending queries to the session
Instance Attribute Summary collapse
-
#session ⇒ ROM::Cassandra::Session
readonly
The session to send queries to.
Class Method Summary collapse
-
.inherited(klass) ⇒ Object
Makes all helper methods private.
Instance Method Summary collapse
-
#call(query) ⇒ Array
Sends the query to Cassandra cluster.
-
#down ⇒ undefined
abstract
By default does nothing.
-
#initialize(session) ⇒ Migration
constructor
Initializes migration with session to the Cassandra cluster.
-
#keyspace(name) ⇒ ROM::Cassandra::Query
Starts building the CQL query in the context of some keyspace.
-
#up ⇒ undefined
abstract
By default does nothing.
Constructor Details
Instance Attribute Details
#session ⇒ ROM::Cassandra::Session (readonly)
Returns the session to send queries to.
63 64 65 |
# File 'lib/rom/cassandra/migrations/migration.rb', line 63 def session @session end |
Class Method Details
.inherited(klass) ⇒ Object
Makes all helper methods private
46 47 48 |
# File 'lib/rom/cassandra/migrations/migration.rb', line 46 def self.inherited(klass) klass.__send__(:private, :call, :keyspace, :up, :down) end |
Instance Method Details
#call(query) ⇒ Array
Sends the query to Cassandra cluster
89 90 91 |
# File 'lib/rom/cassandra/migrations/migration.rb', line 89 def call(query) session.call query.to_s end |
#down ⇒ undefined
This method is abstract.
By default does nothing
80 81 |
# File 'lib/rom/cassandra/migrations/migration.rb', line 80 def down end |
#keyspace(name) ⇒ ROM::Cassandra::Query
Starts building the CQL query in the context of some keyspace
99 100 101 |
# File 'lib/rom/cassandra/migrations/migration.rb', line 99 def keyspace(name) @builder.keyspace(name) end |
#up ⇒ undefined
This method is abstract.
By default does nothing
71 72 |
# File 'lib/rom/cassandra/migrations/migration.rb', line 71 def up end |