fix(api): 0002_decks_archived_at — schließt Schema-Drift
Some checks are pending
CI / validate (push) Waiting to run

Production-DB hatte cards.decks.archived_at nicht, obwohl 0000_baseline
die Spalte im CREATE TABLE hat. Ursache: Schema-Datei wurde nach
initialer DB-Provisionierung um archived_at erweitert, ohne separate
ADD-COLUMN-Migration zu generieren. Resultat: cards-native
DeckListView triggert GET /api/v1/decks → isNull(decks.archivedAt) →
PostgresError → HTTP 500.

Fix:
- 0002_decks_archived_at.sql mit ALTER TABLE IF NOT EXISTS (idempotent)
- _journal.json updaten
- Auf Production manuell schon angewandt 2026-05-13 — diese Migration
  ist nur für fresh Setups + Migration-State-Konsistenz

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-05-13 15:32:25 +02:00
parent c6488c0b83
commit 4d905bb4cd
2 changed files with 20 additions and 0 deletions

View file

@ -0,0 +1,13 @@
-- Add `archived_at` to cards.decks.
--
-- Hintergrund: 0000_baseline.sql hat die Spalte zwar im CREATE TABLE,
-- aber die Production-DB wurde damals noch vor dem archived_at-Add
-- aufgespielt, sodass die echte Tabelle bis 2026-05-13 keine
-- archived_at-Spalte hatte. cards-native's DeckListView triggert
-- GET /api/v1/decks, der Hono-Handler fragt `isNull(decks.archivedAt)`
-- ab → Postgres-Error "column does not exist" → HTTP 500.
--
-- Idempotent (`IF NOT EXISTS`), damit fresh Setups (wo die Spalte
-- via Baseline schon da ist) den Schritt überspringen.
ALTER TABLE "cards"."decks" ADD COLUMN IF NOT EXISTS "archived_at" timestamp with time zone;

View file

@ -15,6 +15,13 @@
"when": 1747180800000, "when": 1747180800000,
"tag": "0001_reviews_prev_snapshot", "tag": "0001_reviews_prev_snapshot",
"breakpoints": true "breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1779075600000,
"tag": "0002_decks_archived_at",
"breakpoints": true
} }
] ]
} }