feat(db): Add automated safe migration on startup

This commit is contained in:
Michael committed 2026-01-20 14:03:58 +01:00
1 parent 60e89cb2bf
commit 4c06e5951d
6 files changed
+1283 -27

No files matched your search

+4
View File
@@ -11,6 +11,7 @@ import { setupVite, serveStatic, log } from "./vite";
import { schedulerService } from "./services/scheduler";
import { ensureAdminUserExists } from "./init-admin";
import { startTokenCron } from "./cron";
import { migrate } from "./migrate";
const app = express();
const PgSession = connectPgSimple(session);
@@ -147,6 +148,9 @@ app.use((req, res, next) => {
});
(async () => {
// Run database migration first
await migrate();
const server = await registerRoutes(app);
app.use((err: any, _req: Request, res: Response, _next: NextFunction) => {