-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
52 lines (48 loc) · 1.33 KB
/
schema.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
CREATE TABLE IF NOT EXISTS providers (
name text NOT NULL,
root text,
origin text,
PRIMARY KEY (name)
);
CREATE TABLE IF NOT EXISTS repos (
id uuid DEFAULT gen_random_uuid() NOT NULL,
repo text NOT NULL,
provider text NOT NULL,
is_duplicate boolean not null default false,
PRIMARY KEY (id),
FOREIGN KEY (provider) REFERENCES providers (name)
);
CREATE TABLE IF NOT EXISTS git_commit_stats (
repo_id uuid NOT NULL,
commit_hash text NOT NULL,
file_path text NOT NULL,
additions integer NOT NULL,
deletions integer NOT NULL,
PRIMARY KEY (repo_id, commit_hash, file_path),
FOREIGN KEY (repo_id) REFERENCES repos(id)
);
CREATE TABLE IF NOT EXISTS git_commits (
repo_id uuid NOT NULL,
hash text NOT NULL,
message text,
author_name text,
author_email text,
author_when timestamp_ns NOT NULL,
committer_name text,
committer_email text,
committer_when timestamp_ns NOT NULL,
parents integer NOT NULL,
additions integer,
deletions integer,
PRIMARY KEY (repo_id, hash),
FOREIGN KEY (repo_id) REFERENCES repos(id)
);
CREATE TABLE IF NOT EXISTS git_files (
repo_id uuid NOT NULL,
path text NOT NULL,
executable boolean NOT NULL,
size int,
ext text,
PRIMARY KEY (repo_id, path),
FOREIGN KEY (repo_id) REFERENCES repos(id)
);