docs(quick-260708-cuc): FavoriteLink migration fix — deployed and verified live
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+33
@@ -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.
|
||||
Reference in New Issue
Block a user