Class: CassandraModel::TableDescriptor

Inherits:
Record
  • Object
show all
Defined in:
lib/cassandra_model/table_descriptor.rb

Instance Attribute Summary

Attributes inherited from Record

#attributes, #execution_info, #valid

Attributes included from Scopes

#scopes

Class Method Summary collapse

Methods inherited from Record

#==, batch_type, before_save, before_save_callbacks, cassandra_columns, #clustering_columns, columns, composite_defaults, connection_name=, #delete, #delete_async, denormalized_column_map, first, first_async, #initialize, #inspect, #invalidate!, normalized_attributes, normalized_column, order_by_clause, #partition_key, #primary_key, query_for_delete, query_for_save, query_for_update, request, request_async, request_meta, restriction_attributes, #save, #save_async, save_in_batch, select_column, select_columns, shard, shard_key, table, table=, table_name=, #update, #update_async

Methods included from Scopes

#scope

Methods included from QueryHelper

#after, #all, #before, def_query_helper, #find_by

Methods included from RecordDebug

#debug

Methods included from DisplayableAttributes

#as_json, included

Methods included from MetaColumns

included

Constructor Details

This class inherits a constructor from CassandraModel::Record

Class Method Details

.create(table_definition) ⇒ Object



11
12
13
# File 'lib/cassandra_model/table_descriptor.rb', line 11

def create(table_definition)
  create_async(table_definition).get
end

.create_async(table_definition) ⇒ Object



7
8
9
# File 'lib/cassandra_model/table_descriptor.rb', line 7

def create_async(table_definition)
  super(table_descriptor(table_definition), check_exists: true)
end

.create_descriptor_tableObject



15
16
17
# File 'lib/cassandra_model/table_descriptor.rb', line 15

def create_descriptor_table
  session.execute(table_desc.to_cql(no_id: true)) unless descriptor_table_exists?
end

.drop_descriptor_tableObject



19
20
21
# File 'lib/cassandra_model/table_descriptor.rb', line 19

def drop_descriptor_table
  session.execute("DROP TABLE #{table_name}") if descriptor_table_exists?
end