-- Auswahl, welche Übungen der aktuelle Abruf ausliefert. Frühere Lieferpakete schalten das nicht mit ein. ALTER TABLE exercises ADD COLUMN IF NOT EXISTS api_offered BOOLEAN NOT NULL DEFAULT FALSE; CREATE INDEX IF NOT EXISTS idx_exercises_api_offered ON exercises (id) WHERE api_offered = TRUE; CREATE TABLE IF NOT EXISTS distribution_catalog_snapshots ( id UUID PRIMARY KEY, binding_id UUID NOT NULL REFERENCES distribution_bindings (id), snapshot JSONB NOT NULL, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() ); CREATE INDEX IF NOT EXISTS idx_distribution_catalog_snapshots_binding ON distribution_catalog_snapshots (binding_id, created_at DESC);