fix(api): 0004-Migration referenziert wordeck-Schema (war: cards)
Some checks are pending
CI / validate (push) Waiting to run
Some checks are pending
CI / validate (push) Waiting to run
Die Text-Only-Cutoff-Migration aus dem Rebrand-Lift schrieb gegen \"cards\".\"cards\" — historischer Pre-Rebrand-Schema-Name. Auf prod heißt das Schema seit Phase 0 `wordeck`. Drizzle-Migrator crashte mit `relation \"cards.cards\" does not exist`. Alle 6 cards.X-References auf wordeck.X umgeschrieben. Migration bleibt idempotent (IF EXISTS / DO-BLOCK), Re-Run harmlos. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
03485ec780
commit
332e27df14
1 changed files with 6 additions and 6 deletions
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
-- 1. Verbleibende Karten der gestrichenen Typen löschen
|
||||
-- (sollte nach Audit 0 betreffen).
|
||||
DELETE FROM "cards"."cards" WHERE "type" IN ('image-occlusion', 'audio');
|
||||
DELETE FROM "wordeck"."cards" WHERE "type" IN ('image-occlusion', 'audio');
|
||||
|
||||
-- 2. CHECK-Constraint für erlaubte CardTypes.
|
||||
DO $$
|
||||
|
|
@ -32,22 +32,22 @@ BEGIN
|
|||
IF NOT EXISTS (
|
||||
SELECT 1 FROM pg_constraint WHERE conname = 'cards_type_check'
|
||||
) THEN
|
||||
ALTER TABLE "cards"."cards"
|
||||
ALTER TABLE "wordeck"."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";
|
||||
ALTER TABLE "wordeck"."cards" DROP COLUMN IF EXISTS "media_refs";
|
||||
|
||||
-- 4. media_files- und media_refs-Tabellen droppen.
|
||||
DROP TABLE IF EXISTS "cards"."media_files";
|
||||
DROP TABLE IF EXISTS "cards"."media_refs" CASCADE;
|
||||
DROP TABLE IF EXISTS "wordeck"."media_files";
|
||||
DROP TABLE IF EXISTS "wordeck"."media_refs" CASCADE;
|
||||
|
||||
-- 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"
|
||||
UPDATE "wordeck"."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