forked from stopipv/isdi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
75 lines (72 loc) · 2.38 KB
/
schema.sql
File metadata and controls
75 lines (72 loc) · 2.38 KB
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
CREATE TABLE IF NOT EXISTS clients (
id INTEGER PRIMARY KEY AUTOINCREMENT,
clientid TEXT,
location TEXT,
issues TEXT, -- JSON dump of checkboxed answers
assessment TEXT,
plan TEXT,
the_rest TEXT, -- if structure changes, keep json dump in here
time DATETIME DEFAULT (datetime('now', 'localtime'))
);
CREATE TABLE IF NOT EXISTS scan_res (
id INTEGER PRIMARY KEY AUTOINCREMENT,
clientid TEXT,
serial TEXT,
note TEXT,
device TEXT,
device_model TEXT,
device_manufacturer TEXT,
device_version TEXT,
is_rooted INTEGER,
rooted_reasons TEXT,
last_full_charge DATETIME,
device_primary_user TEXT,
device_access TEXT, -- JSONdump of person, frequency of access / todo
how_obtained TEXT, -- todo
time DATETIME DEFAULT (datetime('now', 'localtime')),
FOREIGN KEY(clientid) REFERENCES clients(clientid)
--battery_avg_last_charged INTEGER, -- take out maybe
);
CREATE TABLE IF NOT EXISTS app_info (
id INTEGER PRIMARY KEY AUTOINCREMENT,
scanid INTEGER,
appid TEXT,
flags TEXT,
remark TEXT,
action_taken TEXT,
apk_path TEXT,
install_date DATETIME,
last_updated DATETIME,
app_version TEXT,
permissions TEXT,
permissions_reason TEXT,
permissions_used DATETIME,
data_usage INTEGER, -- Mobile total received: Wifi-Total
battery_usage INTEGER, -- in mAh. show "not more than average app on your device" rather than actual amount on front-end.
time DATETIME DEFAULT (datetime('now', 'localtime')),
FOREIGN KEY(scanid) REFERENCES scan_res(id)
);
-- see also, how battery usage is measured on phone app itself in settings. percent of battery used by app.E
-- https://stackoverflow.com/questions/45751387/how-do-i-calculate-the-battery-drain-for-a-particular-app-using-dumpsys-batterys
CREATE INDEX IF NOT EXISTS idx_scan_res_clientid on scan_res (clientid);
CREATE INDEX IF NOT EXISTS idx_app_info_scanid on app_info (scanid);
--
-- CREATE TABLE IF NOT EXISTS notes (
-- id INTEGER PRIMARY KEY AUTOINCREMENT,
-- serial TEXT,
-- appid TEXT,
-- note TEXT,
-- time DATETIME DEFAULT (datetime('now', 'localtime')),
-- device TEXT,
-- PRIMARY KEY (id)
-- );
--
-- This is a backup table to keep logs of everything.
-- CREATE TABLE IF NOT EXISTS all_logs (
-- id INTEGER PRIMARY KEY AUTOINCREMENT,
-- args TEXT,
-- formargs TEXT,
-- httpmethod TEXT,
-- res TEXT,
-- time DATETIME DEFAULT (datetime('now', 'localtime'))
-- );