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 { runCLI } from "./server/cli";
|
||||||
import { createStartHandler, defaultStreamHandler, defineHandlerCallback } from "@tanstack/react-start/server";
|
import { createStartHandler, defaultStreamHandler, defineHandlerCallback } from "@tanstack/react-start/server";
|
||||||
import { createServerEntry } from "@tanstack/react-start/server-entry";
|
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);
|
const cliRun = await runCLI(Bun.argv);
|
||||||
if (cliRun) {
|
if (cliRun) {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import { handleServiceError } from "./utils/errors";
|
||||||
import { logger } from "./utils/logger";
|
import { logger } from "./utils/logger";
|
||||||
import { config } from "./core/config";
|
import { config } from "./core/config";
|
||||||
import { auth } from "~/server/lib/auth";
|
import { auth } from "~/server/lib/auth";
|
||||||
|
import { db } from "./db/db";
|
||||||
|
|
||||||
export const generalDescriptor = (app: Hono) =>
|
export const generalDescriptor = (app: Hono) =>
|
||||||
openAPIRouteHandler(app, {
|
openAPIRouteHandler(app, {
|
||||||
|
|
@ -38,6 +39,7 @@ export const scalarDescriptor = Scalar({
|
||||||
});
|
});
|
||||||
|
|
||||||
export const createApp = () => {
|
export const createApp = () => {
|
||||||
|
db.run("PRAGMA foreign_keys = ON;");
|
||||||
const app = new Hono();
|
const app = new Hono();
|
||||||
|
|
||||||
if (config.trustedOrigins) {
|
if (config.trustedOrigins) {
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import { bootstrapApplication } from "../modules/lifecycle/bootstrap";
|
||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
import { toMessage } from "../utils/errors";
|
import { toMessage } from "../utils/errors";
|
||||||
|
|
||||||
export default definePlugin(() => {
|
export default definePlugin(async () => {
|
||||||
void bootstrapApplication().catch((err) => {
|
await bootstrapApplication().catch((err) => {
|
||||||
logger.error(`Bootstrap failed: ${toMessage(err)}`);
|
logger.error(`Bootstrap failed: ${toMessage(err)}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue