hotfix(1.4.1): fix migration FK failure + null toLowerCase crash
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 18m13s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 18m13s
This commit is contained in:
@@ -3,6 +3,12 @@
|
||||
Alle nennenswerten Änderungen an diesem Projekt werden in dieser Datei dokumentiert.
|
||||
Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.0.0/).
|
||||
|
||||
## [1.4.1] – 2026-05-20 — Hotfix: Production 500 & Null-Crash
|
||||
|
||||
### Behoben
|
||||
- **Migration `prisma/migrate.js`**: `ALTER TABLE ... ADD COLUMN ... REFERENCES` auf PostgreSQL mit bestehenden Daten führte zu stillen Fehlern. Spalte `categoryId` wird jetzt ohne Inline-REFERENCES angelegt; Foreign-Key wird in separatem idempotenten Schritt (15b) erstellt.
|
||||
- **Frontend `right-sidebar.tsx`**: `s.name.toLowerCase()` crashte wenn Symbol-Name `null` war. Optionaler Fallback auf leeren String hinzugefügt.
|
||||
|
||||
## [1.4.0] – 2026-05-20 — Phase 1: Symbol-Architektur Redesign
|
||||
|
||||
### Neu
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lageplan",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"description": "Feuerwehr Lageplan - Krokier-App für Einsatzdokumentation",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -277,7 +277,7 @@ async function migrate() {
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "name" TEXT`,
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "svgPath" TEXT`,
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "isUploaded" BOOLEAN NOT NULL DEFAULT false`,
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "categoryId" TEXT REFERENCES tenant_categories(id) ON DELETE SET NULL`,
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "categoryId" TEXT`,
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "migratedFromIconId" TEXT`,
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP`,
|
||||
`ALTER TABLE tenant_symbols ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP`,
|
||||
@@ -288,6 +288,29 @@ async function migrate() {
|
||||
}
|
||||
console.log(` ${tsAdded}/${tenantSymbolColumns.length} tenant_symbol columns added`)
|
||||
|
||||
// ─── Step 15b: Add tenant_symbols.categoryId FK separately (idempotent) ───
|
||||
console.log(' [15b] Adding tenant_symbols.categoryId FK...')
|
||||
try {
|
||||
await prisma.$executeRawUnsafe(`
|
||||
DO $$ BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.table_constraints
|
||||
WHERE constraint_name = 'tenant_symbols_categoryId_fkey'
|
||||
AND table_name = 'tenant_symbols'
|
||||
) THEN
|
||||
ALTER TABLE tenant_symbols
|
||||
ADD CONSTRAINT "tenant_symbols_categoryId_fkey"
|
||||
FOREIGN KEY ("categoryId") REFERENCES tenant_categories(id) ON DELETE SET NULL;
|
||||
END IF;
|
||||
EXCEPTION WHEN OTHERS THEN
|
||||
RAISE NOTICE 'categoryId FK skipped: %', SQLERRM;
|
||||
END $$;
|
||||
`)
|
||||
console.log(' ✅ tenant_symbols.categoryId FK added')
|
||||
} catch (e) {
|
||||
console.log(' categoryId FK skipped:', e.message)
|
||||
}
|
||||
|
||||
// ─── Step 16: Fix tenant_symbols FK (CASCADE → SET NULL) ───
|
||||
console.log(' [16] Fixing tenant_symbols.iconId FK (CASCADE → SET NULL)...')
|
||||
try {
|
||||
|
||||
@@ -191,13 +191,13 @@ export function RightSidebar({ onSymbolDrop, canEdit, isOpen, onToggle, activeTa
|
||||
const filteredCategories = categories.map((cat) => ({
|
||||
...cat,
|
||||
symbols: cat.symbols.filter((s) =>
|
||||
s.name.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
(s.name || '').toLowerCase().includes(searchQuery.toLowerCase())
|
||||
),
|
||||
}))
|
||||
const filteredTenantGroups = tenantGroups.map(g => ({
|
||||
...g,
|
||||
symbols: g.symbols.filter(s =>
|
||||
s.name.toLowerCase().includes(searchQuery.toLowerCase())
|
||||
(s.name || '').toLowerCase().includes(searchQuery.toLowerCase())
|
||||
),
|
||||
})).filter(g => g.symbols.length > 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user