-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.cql
49 lines (45 loc) · 1.09 KB
/
schema.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
37
38
39
40
41
42
43
44
45
46
47
48
49
CREATE KEYSPACE inventory
WITH durable_writes = true
AND replication = {
'class' : 'SimpleStrategy',
'replication_factor' : 1
};
CREATE TYPE inventory.inventory_record (
quantity int,
unit_price decimal
);
CREATE TABLE inventory.summary (
cust_id uuid,
prd_id uuid,
trx_id timeuuid,
available LIST<FROZEN<inventory_record>>,
available_quantity int,
available_value decimal,
rm_quantity int,
rm_value decimal,
total_quantity int,
total_value decimal,
PRIMARY KEY (( cust_id, prd_id ), trx_id)
) WITH CLUSTERING ORDER BY (trx_id DESC);
CREATE TABLE inventory.log (
cust_id uuid,
prd_id uuid,
trx_id timeuuid,
operation text,
records LIST<FROZEN<inventory_record>>,
PRIMARY KEY (( cust_id, prd_id ), trx_id)
) WITH CLUSTERING ORDER BY (trx_id DESC);
CREATE TABLE inventory.lock (
prd_id uuid,
cust_id uuid,
PRIMARY KEY (prd_id, cust_id)
) WITH default_time_to_live = 60
AND gc_grace_seconds = 86400
AND memtable_flush_period_in_ms = 60000
AND caching = {
'keys' : 'ALL',
'rows_per_partition' : 'ALL'
}
AND compaction = {
'class' : 'DateTieredCompactionStrategy'
};