fix: apply fk db constraint on app creation

This commit is contained in:
Nicolas Meienberger 2026-02-16 22:20:57 +01:00
parent db163a1bb5
commit 11efe87b2e
3 changed files with 4 additions and 5 deletions

View file

@ -3,9 +3,6 @@ import { shutdown } from "./server/modules/lifecycle/shutdown";
import { runCLI } from "./server/cli";
import { createStartHandler, defaultStreamHandler, defineHandlerCallback } from "@tanstack/react-start/server";
import { createServerEntry } from "@tanstack/react-start/server-entry";
import { sqlite } from "./server/db/db";
sqlite.run("PRAGMA foreign_keys = ON;");
const cliRun = await runCLI(Bun.argv);
if (cliRun) {

View file

@ -18,6 +18,7 @@ import { handleServiceError } from "./utils/errors";
import { logger } from "./utils/logger";
import { config } from "./core/config";
import { auth } from "~/server/lib/auth";
import { db } from "./db/db";
export const generalDescriptor = (app: Hono) =>
openAPIRouteHandler(app, {
@ -38,6 +39,7 @@ export const scalarDescriptor = Scalar({
});
export const createApp = () => {
db.run("PRAGMA foreign_keys = ON;");
const app = new Hono();
if (config.trustedOrigins) {

View file

@ -3,8 +3,8 @@ import { bootstrapApplication } from "../modules/lifecycle/bootstrap";
import { logger } from "../utils/logger";
import { toMessage } from "../utils/errors";
export default definePlugin(() => {
void bootstrapApplication().catch((err) => {
export default definePlugin(async () => {
await bootstrapApplication().catch((err) => {
logger.error(`Bootstrap failed: ${toMessage(err)}`);
process.exit(1);
});