forked from simon987/od-database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_script.sql
64 lines (53 loc) · 1.21 KB
/
init_script.sql
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
PRAGMA journal_mode=WAL;
CREATE TABLE Website (
id INTEGER PRIMARY KEY NOT NULL,
url TEXT,
logged_ip TEXT,
logged_useragent TEXT,
last_modified INTEGER DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE Admin (
username TEXT PRIMARY KEY NOT NULL,
password TEXT
);
CREATE TABLE BlacklistedWebsite (
id INTEGER PRIMARY KEY NOT NULL,
url TEXT
);
CREATE TABLE TaskResult (
id INTEGER PRIMARY KEY,
server TEXT,
website_id INT,
status_code TEXT,
file_count INT,
start_time TIMESTAMP,
end_time TIMESTAMP,
indexed_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (server) REFERENCES ApiClient(name)
);
CREATE TABLE ApiClient (
name TEXT PRIMARY KEY NOT NULL,
token TEXT NOT NULL
);
CREATE TABLE SearchLogEntry (
id INTEGER PRIMARY KEY,
search_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
remote_addr TEXT,
forwarded_for TEXT,
query TEXT,
extensions TEXT,
page INT,
blocked INT DEFAULT 0,
results INT DEFAULT 0,
took INT DEFAULT 0
);
CREATE TABLE Queue (
id INTEGER PRIMARY KEY,
website_id INTEGER,
url TEXT,
priority INTEGER,
callback_type TEXT,
callback_args TEXT,
assigned_crawler TEXT NULL DEFAULT NULL,
FOREIGN KEY (assigned_crawler) REFERENCES ApiClient(name)
);