feat: Wordeck-Vorarbeiten — Datenschutz-Seite + Text-Only-Migration
Some checks are pending
CI / validate (push) Waiting to run
Some checks are pending
CI / validate (push) Waiting to run
Privacy/+page.svelte: Cards → Wordeck, MinIO-Erwähnung entfernt (text-only, kein Object-Storage), Bilder/Audio explizit als "speichern wir NICHT" markiert, Bundle ev.mana.wordeck. 0004_wordeck_text_only.sql: Migration für CardType-Cutoff (image-occlusion/audio raus, CHECK-Constraint, media_files-DROP). Vor-Audit gegen prod hat 0 betroffene Karten gezeigt — die Migration ist defensiv und idempotent, kann ohne Daten-Verlust gefahren werden. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
29351f881d
commit
22927fbe59
2 changed files with 68 additions and 11 deletions
52
apps/api/src/db/migrations/0004_wordeck_text_only.sql
Normal file
52
apps/api/src/db/migrations/0004_wordeck_text_only.sql
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
-- Wordeck-Rebrand: Text-Only-Architektur (CardType-Cutoff).
|
||||
--
|
||||
-- Mit dem Brand-Wechsel von Cards zu Wordeck (siehe
|
||||
-- mana/docs/playbooks/WORDECK_REBRAND.md) entfallen die CardTypes
|
||||
-- `image-occlusion` und `audio` ersatzlos. Wordeck speichert nur Worte.
|
||||
--
|
||||
-- Vor-Audit gegen prod am 2026-05-17:
|
||||
-- SELECT type, COUNT(*) FROM cards.cards GROUP BY type;
|
||||
-- basic 123
|
||||
-- cloze 44
|
||||
-- multiple-choice 19
|
||||
-- basic-reverse 0 (keine in der DB — alle Marketplace-Decks)
|
||||
-- type-in 0
|
||||
-- image-occlusion 0 ← Cutoff ist trivial
|
||||
-- audio 0 ← Cutoff ist trivial
|
||||
-- SELECT COUNT(*) FROM cards.media_files; → 0
|
||||
--
|
||||
-- Diese Migration ist deshalb defensiv: löscht eventuelle Karten der
|
||||
-- gestrichenen Typen, fügt einen CHECK-Constraint hinzu und entfernt
|
||||
-- die ungenutzte media_files-Tabelle + media_refs-Spalte.
|
||||
--
|
||||
-- Idempotent geschrieben (IF EXISTS / DO-Blocks), damit Re-Runs
|
||||
-- harmlos sind.
|
||||
|
||||
-- 1. Verbleibende Karten der gestrichenen Typen löschen
|
||||
-- (sollte nach Audit 0 betreffen).
|
||||
DELETE FROM "cards"."cards" WHERE "type" IN ('image-occlusion', 'audio');
|
||||
|
||||
-- 2. CHECK-Constraint für erlaubte CardTypes.
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM pg_constraint WHERE conname = 'cards_type_check'
|
||||
) THEN
|
||||
ALTER TABLE "cards"."cards"
|
||||
ADD CONSTRAINT "cards_type_check"
|
||||
CHECK ("type" IN ('basic', 'basic-reverse', 'cloze', 'type-in', 'multiple-choice'));
|
||||
END IF;
|
||||
END$$;
|
||||
|
||||
-- 3. media_refs-Spalte aus cards droppen (war nie produktiv genutzt).
|
||||
ALTER TABLE "cards"."cards" DROP COLUMN IF EXISTS "media_refs";
|
||||
|
||||
-- 4. media_files-Tabelle droppen.
|
||||
DROP TABLE IF EXISTS "cards"."media_files";
|
||||
|
||||
-- 5. Optional: Wenn fields ein image_ref-Key enthält, säubern.
|
||||
-- (Image-Occlusion-Karten sind oben schon gelöscht — das ist ein
|
||||
-- Defense-in-Depth-Schritt für falsch annotierte basic-Karten.)
|
||||
UPDATE "cards"."cards"
|
||||
SET "fields" = "fields" - 'image_ref' - 'mask_regions'
|
||||
WHERE "fields" ?| array['image_ref', 'mask_regions'];
|
||||
Loading…
Add table
Add a link
Reference in a new issue