internal/store/migrations/0021_activity.up.sql
12 lines · 594 bytes
1-- Commits as an activity signal: recorded when they land on the default
2-- branch, attributed by verified author email, deduped by sha so rebases
3-- and re-pushes never double-count. day is the author date (YYYY-MM-DD),
4-- so imported history keeps its real timeline.
5CREATE TABLE commit_activity (
6 repo_id INTEGER NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
7 sha TEXT NOT NULL,
8 user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
9 day TEXT NOT NULL,
10 PRIMARY KEY (repo_id, sha)
11);
12CREATE INDEX commit_activity_user ON commit_activity(user_id, day);