Sha256: 702839877c3a215363a9cc01129b86bf8568e840816ad69308951e316c513b08
Contents?: true
Size: 1.04 KB
Versions: 6
Compression:
Stored size: 1.04 KB
Contents
require 'cassandra_object/schema/tasks' module CassandraObject class Schema extend Tasks class << self def create_keyspace(keyspace) system_execute "CREATE KEYSPACE #{keyspace} " + "WITH strategy_class = SimpleStrategy " + " AND strategy_options:replication_factor = 1" end def drop_keyspace(keyspace) system_execute "DROP KEYSPACE #{keyspace}" end def create_column_family(column_family) execute "CREATE COLUMNFAMILY #{column_family} " + "(KEY varchar PRIMARY KEY)" end def alter_column_family_with(with) execute "ALTER TABLE users WITH #{with}" end def add_index() end private def execute(cql) CassandraObject::Base.execute_cql cql end def system_execute(cql) @system_cql ||= CassandraCQL::Database.new(CassandraObject::Base.connection_config.servers, keyspace: 'system') @system_cql.execute cql end end end end
Version data entries
6 entries across 6 versions & 1 rubygems