g1t/services/actions/migrations/0005_actions_cache.sql
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Fast pages, required checks on the branch, self-hosted runners, honest incidents | 1 | -- The actions/cache entries of each repository, kept in R2 (the API's |
| 2 | -- ACTIONS_CACHE bucket): which keys there are, how big, and when each was | |
| 3 | -- last restored, for restore keys, the repository's quota and eviction. | |
| 4 | -- See services/actions/src/cache.rs. | |
| 5 | -- | |
| 6 | -- Every statement can run twice: a table or index that exists is left as | |
| 7 | -- it is. | |
| 8 | ||
| 9 | CREATE TABLE IF NOT EXISTS cache_entries ( | |
| 10 | id TEXT PRIMARY KEY, | |
| 11 | repo_id TEXT NOT NULL, | |
| 12 | -- The workspace's slug, whose storage it counts toward. | |
| 13 | namespace TEXT NOT NULL, | |
| 14 | key TEXT NOT NULL, | |
| 15 | -- Its object in R2. | |
| 16 | object TEXT NOT NULL, | |
| 17 | size INTEGER NOT NULL DEFAULT 0, | |
| 18 | -- pending (being uploaded), ready, or expired (its object is to be | |
| 19 | -- deleted, then the row). | |
| 20 | status TEXT NOT NULL, | |
| 21 | created_at TEXT NOT NULL, | |
| 22 | last_used_at TEXT NOT NULL, | |
| 23 | UNIQUE (repo_id, key) | |
| 24 | ); | |
| 25 | CREATE INDEX IF NOT EXISTS cache_entries_by_use ON cache_entries (repo_id, status, last_used_at); | |
| 26 | CREATE INDEX IF NOT EXISTS cache_entries_by_status ON cache_entries (status, last_used_at); | |
| 27 | CREATE INDEX IF NOT EXISTS cache_entries_by_namespace ON cache_entries (namespace, status); | |
| 28 | ||
| 29 | -- What each workspace's cache held each day, for its storage charge. | |
| 30 | CREATE TABLE IF NOT EXISTS cache_days ( | |
| 31 | namespace TEXT NOT NULL, | |
| 32 | day TEXT NOT NULL, | |
| 33 | bytes INTEGER NOT NULL, | |
| 34 | PRIMARY KEY (namespace, day) | |
| 35 | ); |