Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
22 lines
1.1 KiB
SQL
22 lines
1.1 KiB
SQL
-- Managed services (portal#77): infrastructure BreakPilot runs for a tenant,
|
|
-- for now Managed Git (one Gitea instance per customer, SKUs
|
|
-- INF-GIT-{CLD,OPR}-{STD,BUS,ENT}). Provisioned by hand (v0); staff keep the
|
|
-- record in the admin area and the portal shows it under "Verwaltete
|
|
-- Infrastruktur". instance_id and notes are staff-only.
|
|
CREATE TABLE managed_services (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
|
|
kind TEXT NOT NULL CHECK (kind IN ('git')),
|
|
name TEXT NOT NULL,
|
|
url TEXT NOT NULL,
|
|
sku TEXT NOT NULL,
|
|
status TEXT NOT NULL DEFAULT 'provisioning'
|
|
CHECK (status IN ('provisioning', 'active', 'restricted', 'halted')),
|
|
instance_id TEXT NOT NULL DEFAULT '',
|
|
notes TEXT NOT NULL DEFAULT '',
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
UNIQUE (tenant_id, kind, url)
|
|
);
|
|
CREATE INDEX managed_services_tenant ON managed_services (tenant_id);
|