-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate-tables.sql
More file actions
67 lines (59 loc) · 2.05 KB
/
Copy pathcreate-tables.sql
File metadata and controls
67 lines (59 loc) · 2.05 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
-- Delete the tables if they exist.
-- Disable foreign key checks, so the tables can
-- be dropped in arbitrary order.
PRAGMA foreign_keys=OFF;
DROP TABLE IF EXISTS GDMs;
DROP TABLE IF EXISTS test_cases;
DROP TABLE IF EXISTS TOX_results;
DROP TABLE IF EXISTS COHER_results;
DROP TABLE IF EXISTS VOCSZ_frequency_list;
DROP TABLE IF EXISTS VOCSZ_non_frequent_list;
DROP TABLE IF EXISTS READIND_results;
PRAGMA foreign_keys=ON;
-- Create the tables.
CREATE TABLE GDMs (
gdm_id TEXT NOT NULL,
date_time DATETIME,
PRIMARY KEY (gdm_id)
);
CREATE TABLE test_cases (
test_id TEXT DEFAULT (lower(hex(randomblob(16)))),
gdm_id TEXT NOT NULL,
date_time_run DATETIME,
PRIMARY KEY (test_id),
FOREIGN KEY (gdm_id) REFERENCES GDMs(gdm_id)
);
CREATE TABLE TOX_results (
test_id TEXT DEFAULT (lower(hex(randomblob(16)))),
conv_nbr INT NOT NULL,
toxicity_type TEXT NOT NULL,
toxicity_level DOUBLE NOT NULL,
FOREIGN KEY (test_id) REFERENCES test_cases(test_id)
);
CREATE TABLE COHER_results (
test_id TEXT DEFAULT (lower(hex(randomblob(16)))),
conv_nbr INT NOT NULL,
neg_pred DOUBLE NOT NULL,
FOREIGN KEY (test_id) REFERENCES test_cases(test_id)
);
CREATE TABLE VOCSZ_frequency_list (
test_id TEXT DEFAULT (lower(hex(randomblob(16)))),
conv_nbr INT NOT NULL,
word TEXT NOT NULL,
word_rank INT NOT NULL,
frequency INT NOT NULL,
FOREIGN KEY (test_id) REFERENCES test_cases(test_id)
);
CREATE TABLE VOCSZ_non_frequent_list (
test_id TEXT DEFAULT (lower(hex(randomblob(16)))),
conv_nbr INT NOT NULL,
word TEXT NOT NULL,
frequency INT NOT NULL,
FOREIGN KEY (test_id) REFERENCES test_cases(test_id)
);
CREATE TABLE READIND_results (
test_id TEXT DEFAULT (lower(hex(randomblob(16)))),
conv_nbr INT NOT NULL,
readab_index DOUBLE NOT NULL,
FOREIGN KEY (test_id) REFERENCES test_cases(test_id)
);