Fix Thumbnail-Generierung (magick statt convert) und DB-Migration fuer role-Spalte

- entrypoint.sh: ImageMagick 7 nutzt 'magick' statt 'convert', Auto-Detection
- database.js: Migration fuer role-Spalte bei bestehender DB (ALTER TABLE)
- main.js: Fallback auf Vollbild wenn Thumbnail fehlt (error handler)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kroonk
2026-04-16 19:40:18 +02:00
parent d393630357
commit ea15be0368
4 changed files with 33 additions and 3 deletions

View File

@@ -17,7 +17,15 @@ db.serialize(() => {
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)`);
// Migration: created_at hinzufuegen falls Tabelle schon existiert
// Migration: Spalten hinzufuegen falls Tabelle schon existiert (alte DB ohne role/created_at)
db.run(`ALTER TABLE users ADD COLUMN role TEXT NOT NULL DEFAULT 'client'`, (err) => {
// Ignoriere Fehler wenn Spalte schon existiert
if (!err) {
// Alte Admins (die einzigen User vor dem Update) als admin markieren
db.run(`UPDATE users SET role = 'admin' WHERE id = 1`);
console.log('Migration: role-Spalte hinzugefuegt, User ID 1 als admin gesetzt');
}
});
db.run(`ALTER TABLE users ADD COLUMN created_at DATETIME DEFAULT CURRENT_TIMESTAMP`, (err) => {
// Ignoriere Fehler wenn Spalte schon existiert
});