-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitdb.cql
77 lines (65 loc) · 1.84 KB
/
initdb.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
CREATE KEYSPACE IF NOT EXISTS bloostatics
WITH replication = {'class': 'SimpleStrategy',
'replication_factor': '1'} AND durable_writes = true;
CREATE TABLE IF NOT EXISTS device (
id timeuuid,
is_empty int,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS doctor (
email text,
password text,
id timeuuid,
surname text,
name text,
registration_date timestamp,
birth_day timestamp,
speciality text,
PRIMARY KEY (email, id, surname, name, password)
) WITH CLUSTERING ORDER BY (id DESC);
CREATE TABLE IF NOT EXISTS patient (
email text,
password text,
surname text,
name text,
doctor_id timeuuid,
device_id timeuuid,
registration_date timestamp,
analyses list<text>,
diagnosis map<text, double>,
PRIMARY KEY (email, password,
surname, name)
) WITH CLUSTERING ORDER BY (password DESC);
CREATE TABLE IF NOT EXISTS general_blood_analysis (
patient_email text,
event_time timestamp,
analysis map<text, double>,
PRIMARY KEY (patient_email, event_time)
) WITH CLUSTERING ORDER BY (event_time DESC);
CREATE TABLE IF NOT EXISTS patients_by_doctor (
doctor_id timeuuid,
surname text,
name text,
email text,
PRIMARY KEY (doctor_id, surname, name)
) WITH CLUSTERING ORDER BY (surname DESC);
UPDATE patient SET diagnosis =
{'none' : -1}
WHERE email = '[email protected]' AND
password = 'sdfsdfsdf' AND
surname = 'Porter' AND
name = 'Jack';
SELECT * FROM general_blood_analysis
WHERE patient_email = '[email protected]'
LIMIT 2;
SELECT * FROM patients_by_doctor WHERE
surname = 'Qsde' AND name =
'Dsda' ALLOW FILTERING;
{
"email" : "qqweqwe",
"password" : "aaaaaa",
"doctorId" : "9fcbdce0-f991-11e5-919c-f7db3580a3b7",
"surname" : "Qsde",
"name" : "Dsda",
"deviceId" : "1ac43350-f994-11e5-b0c8-f7db3580a3b7"
}