-
Notifications
You must be signed in to change notification settings - Fork 8
/
satd.sql
51 lines (47 loc) · 1.57 KB
/
satd.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
DROP TABLE IF EXISTS satd.Commits, satd.SATD, satd.SATDInFile, satd.Projects;
CREATE TABLE IF NOT EXISTS satd.Projects (
p_id INT AUTO_INCREMENT NOT NULL,
p_name VARCHAR(255) NOT NULL UNIQUE,
p_url VARCHAR(255) NOT NULL UNIQUE,
PRIMARY KEY (p_id)
);
CREATE TABLE IF NOT EXISTS satd.SATDInFile (
f_id INT AUTO_INCREMENT,
f_comment VARCHAR(4096),
f_comment_type VARCHAR(32),
f_path VARCHAR(512),
start_line INT,
end_line INT,
containing_class VARCHAR(512),
containing_method VARCHAR(512),
PRIMARY KEY (f_id)
);
CREATE TABLE IF NOT EXISTS satd.Commits(
commit_hash varchar(256),
p_id INT,
author_name varchar(256),
author_email varchar(256),
author_date DATETIME,
committer_name varchar(256),
committer_email varchar(256),
commit_date DATETIME,
PRIMARY KEY (p_id, commit_hash),
FOREIGN KEY (p_id) REFERENCES Projects(p_id)
);
CREATE TABLE IF NOT EXISTS satd.SATD (
satd_id INT AUTO_INCREMENT,
satd_instance_id INT, -- Not a key value, used only to associate SATD Instances
parent_instance_id INT,
p_id INT,
first_commit varchar(256),
second_commit varchar(256),
first_file INT,
second_file INT,
resolution VARCHAR(64),
PRIMARY KEY (satd_id),
FOREIGN KEY (p_id) REFERENCES satd.Projects(p_id),
FOREIGN KEY (p_id, first_commit) REFERENCES satd.Commits(p_id, commit_hash),
FOREIGN KEY (p_id, second_commit) REFERENCES satd.Commits(p_id, commit_hash),
FOREIGN KEY (first_file) REFERENCES satd.SATDInFile(f_id),
FOREIGN KEY (second_file) REFERENCES satd.SATDInFile(f_id)
);