Files
CosmicClash/server/migrations/0007_allocation_quotas.sql
2026-09-01 18:38:06 +01:00

11 lines
534 B
SQL

-- Optional operator-configured regional spend guard. A missing row means
-- unlimited, preserving existing deployments until they opt into a quota.
CREATE TABLE allocation_quotas (
region TEXT PRIMARY KEY CHECK (region IN ('EU', 'NA')),
window_started_at TIMESTAMPTZ NOT NULL,
window_seconds INTEGER NOT NULL CHECK (window_seconds > 0),
used_allocations INTEGER NOT NULL DEFAULT 0 CHECK (used_allocations >= 0),
max_allocations INTEGER NOT NULL CHECK (max_allocations > 0),
updated_at TIMESTAMPTZ NOT NULL
);