Migration 0073: kundengruppen.standard_workspace_id (Schule: Schulcomputer (Mint)); neue Organisationen bekommen Bereitstellungsvorlage und Workspace an "Neue Geräte". Ausrollstufe 'stabil' -> 'testing' (Repo/Spiegel bleiben). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
1.3 KiB
PL/PgSQL
32 lines
1.3 KiB
PL/PgSQL
BEGIN;
|
|
|
|
-- Einstieg vereinfachen, Schritt 1 (platform-docs roadmap/einstieg-
|
|
-- vereinfachen.md, Entscheidungen 25.10.2026).
|
|
--
|
|
-- 1. Jede Art von Organisation (Kundengruppe) bekommt einen Standard-
|
|
-- Workspace. Eine neue Organisation dieser Art bekommt damit beim Anlegen
|
|
-- ihre Bereitstellungsvorlage und den Workspace an "Neue Geräte", ohne
|
|
-- weitere Handgriffe. Schule: "Schulcomputer (Mint)"; Unternehmen noch
|
|
-- keiner.
|
|
-- 2. Drei Ausrollstufen: Vorab (Tuxflotte), Testing (Testschulen), Stabil
|
|
-- (zahlende Kunden, kommt später). Die bisherige Stufe "stabil" ist
|
|
-- inhaltlich "Testing" und wird umbenannt; Repo und Spiegel bleiben.
|
|
|
|
ALTER TABLE kundengruppen
|
|
ADD COLUMN standard_workspace_id UUID REFERENCES workspaces(id) ON DELETE SET NULL;
|
|
|
|
UPDATE kundengruppen
|
|
SET standard_workspace_id = (
|
|
SELECT id FROM workspaces
|
|
WHERE name = 'Schulcomputer (Mint)' AND organization_id IS NULL AND backend_id IS NOT NULL
|
|
)
|
|
WHERE key = 'schule';
|
|
|
|
ALTER TABLE organizations DROP CONSTRAINT organizations_ausrollstufe_check;
|
|
UPDATE organizations SET ausrollstufe = 'testing' WHERE ausrollstufe = 'stabil';
|
|
ALTER TABLE organizations ALTER COLUMN ausrollstufe SET DEFAULT 'testing';
|
|
ALTER TABLE organizations ADD CONSTRAINT organizations_ausrollstufe_check
|
|
CHECK (ausrollstufe IN ('testing', 'vorab'));
|
|
|
|
COMMIT;
|