fix(db): add missing FavoriteLink migration
Tessera CI/CD / Lint & Type Check (push) Successful in 43s
Tessera CI/CD / Tests (push) Successful in 42s
Tessera CI/CD / Build & Publish Images (push) Successful in 21s

FavoriteLink existed in schema.prisma but was never captured in a
migration -- same bug class as the DashboardLayout fix in
20260629130000_add_missing_tables. It silently worked in local dev
(table created via db push) but any environment relying on
`prisma migrate deploy` never got the table, causing every
GET /favorites request to 500 with PrismaClientKnownRequestError
P2021 ("table does not exist").

Found live testing the production deploy at alpha.tessera.ctl.de:
adding a Favoriten widget triggered the 500. Confirmed via server
logs (docker logs) and by inspecting _prisma_migrations / \dt on
that database.

CREATE TABLE/INDEX IF NOT EXISTS makes this safe to apply against
environments where the table already exists untracked (verified: ran
clean against local dev's DB, which already had the table from a
prior db push, with zero errors and zero data loss).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-08 09:16:15 +02:00
parent 60df92b23d
commit afef9b298f
@@ -0,0 +1,29 @@
-- CreateTable
-- FavoriteLink existed in schema.prisma but was never captured in a migration
-- (created via db push in local dev, same class of bug as the DashboardLayout
-- fix in 20260629130000_add_missing_tables). IF NOT EXISTS makes this safe to
-- apply against environments where the table already exists untracked.
CREATE TABLE IF NOT EXISTS "FavoriteLink" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"tenantId" TEXT NOT NULL,
"widgetId" TEXT NOT NULL,
"title" TEXT NOT NULL,
"url" TEXT NOT NULL,
"iconUrl" TEXT,
"position" INTEGER NOT NULL DEFAULT 0,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "FavoriteLink_pkey" PRIMARY KEY ("id"),
CONSTRAINT "FavoriteLink_widgetId_fkey" FOREIGN KEY ("widgetId") REFERENCES "WidgetInstance"("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE INDEX IF NOT EXISTS "FavoriteLink_userId_idx" ON "FavoriteLink"("userId");
-- CreateIndex
CREATE INDEX IF NOT EXISTS "FavoriteLink_tenantId_idx" ON "FavoriteLink"("tenantId");
-- CreateIndex
CREATE INDEX IF NOT EXISTS "FavoriteLink_widgetId_idx" ON "FavoriteLink"("widgetId");