From 2ad875b2cd2df418e57356c06c91430437200b1f Mon Sep 17 00:00:00 2001 From: Schalli Date: Wed, 8 Jul 2026 09:22:41 +0200 Subject: [PATCH] =?UTF-8?q?docs(quick-260708-cuc):=20FavoriteLink=20migrat?= =?UTF-8?q?ion=20fix=20=E2=80=94=20deployed=20and=20verified=20live?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5 --- .planning/STATE.md | 5 +-- .../260708-cuc-SUMMARY.md | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .planning/quick/260708-cuc-fix-favoritelink-tabelle-fehlt-in-prod-d/260708-cuc-SUMMARY.md diff --git a/.planning/STATE.md b/.planning/STATE.md index c0eb620..0d88286 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -149,6 +149,7 @@ None yet. | 260701-abc | Fix i18n: marketplace.accessDenied + calendar form hardcoded EN strings | 2026-07-01 | e5b76b7 | [260701-abc-i18n-missing-keys](.planning/quick/260701-abc-i18n-missing-keys/) | | 260707-csw | LDAP AD Anbindung: Zugangsdaten aus XWiki vorbefuellen und Import-Filter fuer Benutzer/Gruppen | 2026-07-07 | a5c500d | [260707-csw-ldap-ad-anbindung-zugangsdaten-aus-xwiki](.planning/quick/260707-csw-ldap-ad-anbindung-zugangsdaten-aus-xwiki/) | | 260707-lgh | Favoriten-Widget: Icon-Proxy fuer Cross-Origin-Resource-Policy-Seiten (claude.ai) | 2026-07-07 | f06a2ff | [260707-lgh-favoriten-widget-icon-proxy-fuer-cross-o](.planning/quick/260707-lgh-favoriten-widget-icon-proxy-fuer-cross-o/) | +| 260708-cuc | Fix: FavoriteLink-Tabelle fehlt in Prod-DB, nie als Migration committed (500 auf GET /favorites) | 2026-07-08 | afef9b2 | [260708-cuc-fix-favoritelink-tabelle-fehlt-in-prod-d](.planning/quick/260708-cuc-fix-favoritelink-tabelle-fehlt-in-prod-d/) | ## Deferred Items @@ -160,7 +161,7 @@ Items acknowledged and carried forward from previous milestone close: ## Session Continuity -Last session: 2026-07-07T13:42:00.000Z +Last session: 2026-07-08T07:22:00.000Z Stopped at: context exhaustion at 77% (2026-07-02) Resume file: .planning/phases/08-dashboard-widgets-vollimplementierung/08-CONTEXT.md -Last activity: 2026-07-07 - Completed quick task 260707-lgh: Favoriten-Widget Icon-Proxy fuer Cross-Origin-Resource-Policy-Seiten +Last activity: 2026-07-08 - Completed quick task 260708-cuc: Fix FavoriteLink-Tabelle fehlt in Prod-DB; deployed and verified live on alpha.tessera.ctl.de diff --git a/.planning/quick/260708-cuc-fix-favoritelink-tabelle-fehlt-in-prod-d/260708-cuc-SUMMARY.md b/.planning/quick/260708-cuc-fix-favoritelink-tabelle-fehlt-in-prod-d/260708-cuc-SUMMARY.md new file mode 100644 index 0000000..a7701d8 --- /dev/null +++ b/.planning/quick/260708-cuc-fix-favoritelink-tabelle-fehlt-in-prod-d/260708-cuc-SUMMARY.md @@ -0,0 +1,33 @@ +--- +status: complete +--- + +# Quick Task 260708-cuc: Fix FavoriteLink-Tabelle fehlt in Prod-DB + +## Context + +Discovered live while testing the day's other fixes (LDAP AD prefill, sidebar accent color, favorites icon proxy) on the production/test deployment at https://alpha.tessera.ctl.de. Adding a Favoriten widget triggered a 500 on `GET /favorites`. + +## Root cause + +`FavoriteLink` existed in `schema.prisma` but had no corresponding migration file — same bug class as the earlier `DashboardLayout` fix (`20260629130000_add_missing_tables`, 2026-06-29). It worked silently in local dev because the table was created there via `prisma db push` at some point, never captured into a tracked migration. Any environment that provisions its database purely via `prisma migrate deploy` (as both this test server and presumably any other real deployment do) never got the table at all. + +Confirmed via SSH to the test server (192.168.13.12, root, key-based): +- `docker logs tessera-api-1` showed `PrismaClientKnownRequestError P2021: The table public.FavoriteLink does not exist`. +- `docker exec tessera-db-1 psql ... '\dt'` confirmed the table was absent; `_prisma_migrations` had exactly the 7 migration files that exist in the repo — nothing missing on the deploy side, the migration itself was simply never created. + +## Fix + +New migration `20260708090000_add_favorite_link`: `CREATE TABLE IF NOT EXISTS "FavoriteLink"` (+ 3 indexes, FK to `WidgetInstance` with cascade delete/update), matching the exact column/constraint shape already in `schema.prisma` and the style of the prior `add_missing_tables` fix. `IF NOT EXISTS` makes it safe to run against local dev, where the table already exists untracked. + +## Verification + +- `prisma validate` — passed. +- Rebuilt local API image, applied the migration: `docker logs` showed a clean `Applying migration 20260708090000_add_favorite_link` / `All migrations have been successfully applied`, zero errors, existing local `FavoriteLink` rows and structure unchanged (verified via `\d "FavoriteLink"`). +- Pushed to `main`; Gitea CI (lint, type-check, tests, build+push images) ran green (run #200). +- Deployed to the test server (192.168.13.12): `docker compose pull api web && docker compose up -d api web`. Logs confirmed the migration applied there too. +- Live end-to-end on https://alpha.tessera.ctl.de: Favoriten widget loads without error ("Noch keine Favoriten." instead of a crash), added a real Claude favorite, icon rendered correctly via the same-origin proxy (`GET /api-proxy/favorites/:id/icon` → 200), confirming both this fix and the same-day icon-proxy fix work together on the actual production-style deployment. + +## Note + +This is the second occurrence of "model added to schema.prisma without a matching migration." Worth a quick audit of the full model list against migration files periodically, or adding a CI check that fails if `prisma migrate diff` shows drift between the migrations directory and the schema.