20 lines · 802 B
-- Pages traffic, one row per repository per UTC day, flushed from the Counters Durable Object like site_usage.
CREATE TABLE pages_usage (
  repo_id TEXT NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
  day TEXT NOT NULL,
  account_id TEXT REFERENCES accounts(id) ON DELETE SET NULL,
  requests INTEGER NOT NULL DEFAULT 0,
  bytes_out INTEGER NOT NULL DEFAULT 0,
  PRIMARY KEY (repo_id, day)
);

CREATE INDEX pages_usage_account ON pages_usage(account_id, day);

-- Operator kill switch: when set, every Site and Pages project of the account stops serving.
ALTER TABLE account_billing ADD COLUMN hosting_suspended_at INTEGER;

-- R2 garbage collection mark set: content hashes referenced by a retained Pages or Sites manifest in the current run.
CREATE TABLE r2_gc_marks (
  hash TEXT PRIMARY KEY
);