Skip to content

Commit 8d3354a

Browse files
committed
feat: table migration
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
1 parent 370e3f0 commit 8d3354a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- Well-known files inventory per repo, populated by the github-repos-enricher.
2+
CREATE TABLE IF NOT EXISTS repo_well_known_files (
3+
id bigserial PRIMARY KEY,
4+
repo_id bigint NOT NULL REFERENCES repos (id) ON DELETE CASCADE,
5+
file_type text NOT NULL, -- security | contributing | governance | maintainers | code_of_conduct | readme
6+
directory text NOT NULL, -- root | .github | docs
7+
path text NOT NULL,
8+
blob_oid text NOT NULL,
9+
first_seen_at timestamptz NOT NULL DEFAULT NOW(),
10+
-- observation time, not commit time; bumped on content change, disappearance, reappearance
11+
change_detected_at timestamptz NOT NULL DEFAULT NOW(),
12+
checked_at timestamptz NOT NULL,
13+
deleted_at timestamptz,
14+
UNIQUE (repo_id, path)
15+
);
16+
17+
CREATE INDEX IF NOT EXISTS repo_well_known_files_change_detected_at_idx
18+
ON repo_well_known_files (change_detected_at);
19+
20+
CREATE INDEX IF NOT EXISTS repo_well_known_files_file_type_idx
21+
ON repo_well_known_files (file_type)
22+
WHERE deleted_at IS NULL;

0 commit comments

Comments
 (0)