14 lines · 699 B
-- Default-branch commits per (repo, author email, UTC day), published by each repo's RepoInsights Durable
-- Object from its commit index. All-time, since history can be backfilled to any date. Contributions are
-- attributed at query time by joining a user's verified addresses, so adding or removing an email takes
-- effect immediately; force-pushes and default-branch changes rebuild a repo's rows.
CREATE TABLE commit_email_days (
  repo_id TEXT NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
  email TEXT NOT NULL COLLATE NOCASE,
  day TEXT NOT NULL,
  commits INTEGER NOT NULL,
  PRIMARY KEY (repo_id, email, day)
);

CREATE INDEX commit_email_days_email ON commit_email_days(email, day);