-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_db.sql
57 lines (47 loc) · 1.06 KB
/
create_db.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
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS Users;
DROP TABLE IF EXISTS Crawlfiles;
DROP TABLE IF EXISTS Crawls;
DROP TABLE IF EXISTS Files;
CREATE TABLE Users
(
id INT(11) AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
username VARCHAR(30),
password VARCHAR(100),
register_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE Crawls
(
cid INT(11) AUTO_INCREMENT PRIMARY KEY,
crawl_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
pdf_crawled INT(11),
pdf_processed INT(11),
process_errors INT(11),
domain VARCHAR(100),
disk_size BIGINT UNSIGNED,
url LONGTEXT,
hierarchy LONGTEXT,
crawl_total_time BIGINT,
proc_total_time BIGINT
);
CREATE TABLE Files
(
fid INT(11) AUTO_INCREMENT PRIMARY KEY,
processing_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
url LONGTEXT,
stats LONGTEXT
);
CREATE TABLE Crawlfiles
(
fid INT(11),
cid INT(11),
PRIMARY KEY(fid, cid),
FOREIGN KEY (fid)
REFERENCES Files(fid)
ON DELETE CASCADE,
FOREIGN KEY (cid)
REFERENCES Crawls(cid)
ON DELETE CASCADE
);