-
Notifications
You must be signed in to change notification settings - Fork 0
/
socail_network.cql
36 lines (31 loc) · 990 Bytes
/
socail_network.cql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
DROP KEYSPACE IF EXISTS social_network;
CREATE KEYSPACE social_network
WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};
drop table IF EXISTS posts;
CREATE TABLE posts (
group_id int,
shard_id uuid,
post_id timeuuid,
user_id uuid,
user_name text,
content text,
PRIMARY KEY ((group_id,shard_id), post_id)
) WITH compaction = { 'class' : 'LeveledCompactionStrategy' };
drop table IF EXISTS shards;
CREATE TABLE shards (
group_id int,
shard_id uuid,
PRIMARY KEY (group_id,shard_id)
) WITH compaction = { 'class' : 'LeveledCompactionStrategy' };
drop table IF EXISTS group_members;
CREATE TABLE group_members (
user_id uuid,
group_id int,
PRIMARY KEY (user_id, group_id)
) WITH compaction = { 'class' : 'LeveledCompactionStrategy' };
drop table IF EXISTS users;
CREATE TABLE users (
user_id uuid,
user_name text,
PRIMARY KEY (user_id)
) WITH compaction = { 'class' : 'LeveledCompactionStrategy' };