| 1 | -- What went live, and when (src/shipped.ts): when a production deployment |
| 2 | -- succeeds (`deployment_status.created` with `success`, for a g1t.page |
| 3 | -- build or one reported by a workflow or the API), the commits it shipped |
| 4 | -- are written down: those in |
| 5 | -- its commit's history not shipped before. A commit's first production |
| 6 | -- deployment is the one that took it live, so Home can say "Live 9 min |
| 7 | -- after merge" without working anything out on page load. |
| 8 | |
| 9 | -- Each production deployment walked, once, however often its event comes. |
| 10 | -- The first a repository has is when recording began: a change that landed |
| 11 | -- before it is matched to the first production deployment after it instead. |
| 12 | CREATE TABLE shipped_walks ( |
| 13 | deployment_id TEXT PRIMARY KEY, |
| 14 | repo_id TEXT NOT NULL, |
| 15 | sha TEXT NOT NULL, |
| 16 | environment TEXT NOT NULL, |
| 17 | -- RFC 3339: when it went live. |
| 18 | deployed_at TEXT NOT NULL, |
| 19 | -- How many commits it shipped that no deployment had before. |
| 20 | commits INTEGER NOT NULL DEFAULT 0 |
| 21 | ); |
| 22 | CREATE INDEX shipped_walks_by_repo ON shipped_walks (repo_id, deployed_at); |
| 23 | |
| 24 | -- Each commit's first production deployment. |
| 25 | CREATE TABLE shipped_commits ( |
| 26 | repo_id TEXT NOT NULL, |
| 27 | sha TEXT NOT NULL, |
| 28 | deployment_id TEXT NOT NULL, |
| 29 | environment TEXT NOT NULL, |
| 30 | deployed_at TEXT NOT NULL, |
| 31 | -- Where the deployment is on the site: its page, or its workflow run. |
| 32 | url TEXT, |
| 33 | PRIMARY KEY (repo_id, sha) |
| 34 | ); |