| 1 | -- Hosted compute an account pays for (the owner of the repository): Actions jobs on hosted runners |
| 2 | -- and agent sandboxes. A row is open until the job or sandbox ends (lib/quotas.ts). |
| 3 | CREATE TABLE IF NOT EXISTS compute_usage ( |
| 4 | id TEXT PRIMARY KEY, |
| 5 | account_id TEXT NOT NULL, |
| 6 | repo_id TEXT NOT NULL, |
| 7 | kind TEXT NOT NULL, |
| 8 | started_at TEXT NOT NULL, |
| 9 | ended_at TEXT |
| 10 | ); |
| 11 | CREATE INDEX IF NOT EXISTS compute_usage_open ON compute_usage(account_id, kind, ended_at); |
| 12 | CREATE INDEX IF NOT EXISTS compute_usage_started ON compute_usage(account_id, started_at); |
| 13 | |
| 14 | -- A site administrator's per-account overrides of the default quotas; NULL keeps the default, -1 is unlimited. |
| 15 | CREATE TABLE IF NOT EXISTS account_quotas ( |
| 16 | account_id TEXT PRIMARY KEY REFERENCES accounts(id), |
| 17 | hosted_minutes INTEGER, |
| 18 | hosted_jobs INTEGER, |
| 19 | sandboxes INTEGER, |
| 20 | repositories INTEGER, |
| 21 | updated_at TEXT NOT NULL, |
| 22 | updated_by TEXT |
| 23 | ); |