Skip to content

Instantly share code, notes, and snippets.

@joscas
Created June 21, 2014 10:33
Show Gist options
  • Save joscas/65f5c5af1ed5b8c12f49 to your computer and use it in GitHub Desktop.
Save joscas/65f5c5af1ed5b8c12f49 to your computer and use it in GitHub Desktop.
CQL Commands for a Cassandra based Chat App
#!/bin/bash
cqlsh <<CQL
CREATE KEYSPACE chat_app WITH REPLICATION = {'class':'SimpleStrategy', 'replication_factor':1};
USE chat_app;
CREATE TABLE chat_messages (
message_id uuid,
from_user text,
to_user text,
body text,
class text,
time timeuuid,
PRIMARY KEY ((from_user, to_user), time)
) WITH CLUSTERING ORDER BY (time ASC);
CREATE INDEX chat_messages_to_user ON chat_messages (to_user);
CREATE INDEX chat_messages_class ON chat_messages (class);
CQL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment