fix: apply fk db constraint on app creation
This commit is contained in:
parent
db163a1bb5
commit
11efe87b2e
3 changed files with 4 additions and 5 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue