diff --git a/migrations/0012_enrollment_sessions.sql b/migrations/0012_enrollment_sessions.sql new file mode 100644 index 0000000..c2b8f1d --- /dev/null +++ b/migrations/0012_enrollment_sessions.sql @@ -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;