Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] get rid of joint PK, just use local_*_id #15

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions migrations/01-init/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ CREATE TABLE coverage_sample (
raw_upload_id INTEGER REFERENCES raw_upload(id) NOT NULL,

-- This should be an application-managed auto-incremented integer.
local_sample_id INTEGER NOT NULL,
local_sample_id INTEGER PRIMARY KEY,

source_file_id INTEGER REFERENCES source_file(id) NOT NULL,
line_no INTEGER NOT NULL,

coverage_type VARCHAR NOT NULL,
hits INTEGER,
hit_branches INTEGER,
total_branches INTEGER,
total_branches INTEGER

PRIMARY KEY (raw_upload_id, local_sample_id)
-- PRIMARY KEY (raw_upload_id, local_sample_id)
);

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
Expand All @@ -82,16 +82,16 @@ CREATE TABLE branches_data (
local_sample_id INTEGER NOT NULL,

-- This should be an application-managed auto-incremented integer.
local_branch_id INTEGER NOT NULL,
local_branch_id INTEGER PRIMARY KEY,

source_file_id INTEGER REFERENCES source_file(id) NOT NULL,

hits INTEGER NOT NULL,
branch_format VARCHAR NOT NULL,
branch VARCHAR NOT NULL,
branch VARCHAR NOT NULL

FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
PRIMARY KEY (raw_upload_id, local_branch_id)
-- FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
-- PRIMARY KEY (raw_upload_id, local_branch_id)
);

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
Expand All @@ -100,24 +100,24 @@ CREATE TABLE method_data (
local_sample_id INTEGER NOT NULL,

-- This should be an application-managed auto-incremented integer.
local_method_id INTEGER NOT NULL,
local_method_id INTEGER PRIMARY KEY,

source_file_id INTEGER REFERENCES source_file(id) NOT NULL,
line_no INTEGER,

hit_branches INTEGER,
total_branches INTEGER,
hit_complexity_paths INTEGER,
total_complexity INTEGER,
total_complexity INTEGER

FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
PRIMARY KEY (raw_upload_id, local_method_id)
-- FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
-- PRIMARY KEY (raw_upload_id, local_method_id)
);

-- TODO: Measure size/perf impact of making this table `WITHOUT ROWID`
CREATE TABLE span_data (
raw_upload_id INTEGER REFERENCES raw_upload(id) NOT NULL,
local_sample_id INTEGER,
local_sample_id INTEGER PRIMARY KEY,

-- This should be an application-managed auto-incremented integer.
local_span_id INTEGER NOT NULL,
Expand All @@ -128,8 +128,8 @@ CREATE TABLE span_data (
start_line INTEGER,
start_col INTEGER,
end_line INTEGER,
end_col INTEGER,
end_col INTEGER

FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
PRIMARY KEY (raw_upload_id, local_span_id)
-- FOREIGN KEY (raw_upload_id, local_sample_id) REFERENCES coverage_sample(raw_upload_id, local_sample_id),
-- PRIMARY KEY (raw_upload_id, local_span_id)
);
Loading