Module: CassandraMigrations::Cassandra::KeyspaceOperations
- Included in:
- CassandraMigrations::Cassandra
- Defined in:
- lib/cassandra_migrations/cassandra/keyspace_operations.rb
Instance Method Summary collapse
Instance Method Details
#create_keyspace! ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cassandra_migrations/cassandra/keyspace_operations.rb', line 7 def create_keyspace! begin execute( "CREATE KEYSPACE #{Config.keyspace} \ WITH replication = { \ 'class':'#{Config.replication['class']}', \ 'replication_factor': #{Config.replication['replication_factor']} \ }" ) use(Config.keyspace) rescue Exception => exception drop_keyspace! raise exception end end |
#drop_keyspace! ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cassandra_migrations/cassandra/keyspace_operations.rb', line 23 def drop_keyspace! begin execute("DROP KEYSPACE #{Config.keyspace}") rescue Cql::QueryError raise Errors::UnexistingKeyspaceError, Config.keyspace end end |