Files
shinkan-jinkendo/backend/migrations/100_distribution_access.sql
T
LarsandCursor 1527a430b9
Deploy Development / deploy (push) Failing after 32s
Test Suite / pytest-backend (push) Failing after 26s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Failing after 6s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Canceled after 1m34s
Let each tenant create named API keys with content and visibility scope.
Superadmins enable a club for the interface. Club admins and members create the keys. Exercise release lives on its own tab and picks one of those keys.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-23 14:07:31 +01:00

26 lines
1.0 KiB
SQL

-- API-Schnittstelle je Verein und benannte Schlüssel mit Objekt- und Sichtbarkeitsrechten.
-- Bestehende Schlüssel behalten den Abruf von Übungen über alle Sichtbarkeiten, damit die Testschlüssel weiter gelten.
ALTER TABLE clubs
ADD COLUMN IF NOT EXISTS distribution_api_enabled BOOLEAN NOT NULL DEFAULT false;
ALTER TABLE distribution_keys
ADD COLUMN IF NOT EXISTS label TEXT;
ALTER TABLE distribution_keys
ADD COLUMN IF NOT EXISTS objects TEXT[] NOT NULL DEFAULT ARRAY['exercise']::text[];
ALTER TABLE distribution_keys
ADD COLUMN IF NOT EXISTS visibilities TEXT[] NOT NULL DEFAULT ARRAY['official', 'club', 'private']::text[];
ALTER TABLE distribution_keys
ADD COLUMN IF NOT EXISTS context_kind TEXT NOT NULL DEFAULT 'platform';
ALTER TABLE distribution_keys
ADD COLUMN IF NOT EXISTS context_club_id INT REFERENCES clubs (id);
ALTER TABLE distribution_keys
ADD COLUMN IF NOT EXISTS context_profile_id INT REFERENCES profiles (id);
UPDATE distribution_keys SET label = key_prefix WHERE label IS NULL OR btrim(label) = '';