chore: (ai gen) run migrations on startup

This commit is contained in:
2026-01-12 23:09:10 +01:00
parent c8d9a4e132
commit b7bc77fb9a
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import { runMigrations } from "../../app/lib/db/migrate";
export default defineNitroPlugin(async () => {
// Run migrations once when the server starts
try {
await runMigrations();
} catch (error) {
console.error("[Server] Failed to run migrations on startup:", error);
// In production, you may want to throw here to prevent server startup
// For now, we'll just log the error and continue
if (process.env.NODE_ENV === "production") {
throw error;
}
}
});