flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/services/actions/migrations/0005_actions_cache.sql

35 lines1,334 bytesCodeBlame
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
9CREATE 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);
25CREATE INDEX IF NOT EXISTS cache_entries_by_use ON cache_entries (repo_id, status, last_used_at);
26CREATE INDEX IF NOT EXISTS cache_entries_by_status ON cache_entries (status, last_used_at);
27CREATE 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.
30CREATE 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);