feat: enrollment_sessions Tabelle (ADR-0008)

Datenmodell für zeitlich begrenzte, organisationsgebundene Vorab-
Freigaben für geplante Massenrollouts. Verwaltung (anlegen/auflisten/
widerrufen) folgt in einem späteren Schritt zusammen mit der
Neugerät-Bestätigung im Kundenplattform-Admin-Bereich. Der eigentliche
Verbrauch (Auto-Modus-Gate im Installer) ist bewusst nicht Teil dieser
Migration - separates, noch nicht begonnenes Folgeprojekt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Thomas Stallinger 2026-08-05 08:52:09 +02:00
parent 0967f7369e
commit 1e9020c5ba

View File

@ -0,0 +1,22 @@
BEGIN;
-- Siehe ADR-0008: zeitlich begrenzte, organisationsgebundene Vorab-Freigaben
-- fuer geplante Massenrollouts. Der tatsaechliche Verbrauch (devices_used
-- hochzaehlen, Pruefung im Auto-Modus-Gate) ist Teil eines separaten,
-- installer-seitigen Folgeprojekts - hier nur Datenmodell + Verwaltung.
CREATE TABLE enrollment_sessions (
id UUID PRIMARY KEY,
organization_id UUID NOT NULL
REFERENCES organizations(id)
ON DELETE CASCADE,
bereitstellungsvorlage_id UUID NOT NULL
REFERENCES bereitstellungsvorlagen(id)
ON DELETE RESTRICT,
max_devices INTEGER NOT NULL,
devices_used INTEGER NOT NULL DEFAULT 0,
expires_at TIMESTAMPTZ NOT NULL,
revoked_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP
);
COMMIT;