Class: Cequel::Schema::TableWriter
- Inherits:
-
Object
- Object
- Cequel::Schema::TableWriter
- Defined in:
- lib/cequel/schema/table_writer.rb
Overview
Creates a new table schema in the database
Class Method Summary collapse
-
.apply(keyspace, table) ⇒ void
Creates a new table schema in the database given an object representation of the schema to create.
Instance Method Summary collapse
-
#apply ⇒ void
private
Create the table in the keyspace.
-
#initialize(keyspace, table) ⇒ TableWriter
constructor
A new instance of TableWriter.
Constructor Details
#initialize(keyspace, table) ⇒ TableWriter
Returns a new instance of TableWriter.
24 25 26 |
# File 'lib/cequel/schema/table_writer.rb', line 24 def initialize(keyspace, table) @keyspace, @table = keyspace, table end |
Class Method Details
.apply(keyspace, table) ⇒ void
This method returns an undefined value.
Creates a new table schema in the database given an object representation of the schema to create
15 16 17 |
# File 'lib/cequel/schema/table_writer.rb', line 15 def self.apply(keyspace, table) new(keyspace, table).apply end |
Instance Method Details
#apply ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Create the table in the keyspace
36 37 38 39 |
# File 'lib/cequel/schema/table_writer.rb', line 36 def apply keyspace.execute(create_statement) index_statements.each { |statement| keyspace.execute(statement) } end |