-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetrics_db.sql
More file actions
83 lines (75 loc) · 2.22 KB
/
metrics_db.sql
File metadata and controls
83 lines (75 loc) · 2.22 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
75
76
77
78
79
80
81
82
83
CREATE DATABASE metrics;
GRANT ALL ON metrics.* to 'git_miner'@'localhost';
USE metrics;
/**
* The create table command for the repositories retrieved
*/
CREATE TABLE repositories
(
repo_id INTEGER UNSIGNED AUTO_INCREMENT,
repo_name VARCHAR(64),
repo_owner VARCHAR(64),
PRIMARY KEY(repo_id)
);
CREATE TABLE commits
(
commit_id BIGINT UNSIGNED AUTO_INCREMENT,
repo_reference INTEGER UNSIGNED,
project_name VARCHAR(64),
sha_hash VARCHAR(64),
commit_date DATETIME,
PRIMARY KEY(commit_id),
CONSTRAINT fkey_commits_1 FOREIGN KEY (repo_reference) REFERENCES repositories (repo_id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE method
(
method_id BIGINT UNSIGNED AUTO_INCREMENT,
commit_reference BIGINT UNSIGNED,
method_name TEXT,
number_method_line INTEGER,
nested_block_depth INTEGER,
cyclomatic_complexity INTEGER,
number_parameters INTEGER,
PRIMARY KEY(method_id),
CONSTRAINT fk_method_1 FOREIGN KEY (commit_reference) REFERENCES commits (commit_id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE class
(
class_id BIGINT UNSIGNED AUTO_INCREMENT,
commit_reference BIGINT UNSIGNED,
class_name TEXT,
inheritance_depth INTEGER,
weighted_methods INTEGER,
children_count INTEGER,
overridden_methods INTEGER,
lack_cohesion_methods DOUBLE,
attribute_count INTEGER,
static_attribute_count INTEGER,
method_count INTEGER,
static_method_count INTEGER,
specialization_index DOUBLE,
PRIMARY KEY (class_id),
CONSTRAINT fk_class_1 FOREIGN KEY (commit_reference) REFERENCES commits (commit_id) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE package
(
package_id BIGINT UNSIGNED AUTO_INCREMENT,
commit_reference BIGINT UNSIGNED,
package_name TEXT,
afferent_coupling INTEGER,
efferent_coupling INTEGER,
instability DOUBLE,
abstractness DOUBLE,
normalized_distance DOUBLE,
classes_number INTEGER,
interfaces_number INTEGER,
PRIMARY KEY(package_id),
CONSTRAINT fk_package_1 FOREIGN KEY (commit_reference) REFERENCES commits (commit_id) ON DELETE CASCADE ON UPDATE CASCADE
);
/*
DROP TABLE package;
DROP TABLE class;
DROP TABLE method;
DROP TABLE commits;
DROP TABLE repositories;
*/