fix: run migrations in code
Some checks failed
Deploy to GitHub Pages / build_site (push) Failing after 36s

This commit is contained in:
2024-12-20 12:42:45 +01:00
parent c6badff1ee
commit 2814165ee6
12 changed files with 189 additions and 446 deletions

View File

@ -5,6 +5,7 @@ import { cors } from "hono/cors";
import { OpenAPIHono } from "@hono/zod-openapi";
import { nodeRouter } from "./routes/node/node.controller.ts";
import { userRouter } from "./routes/user/user.controller.ts";
import { migrateDb } from "./db/db.ts";
const router = new OpenAPIHono();
@ -26,10 +27,11 @@ router.get("/ui", swaggerUI({ url: "/openapi.json" }));
Deno.serve(router.fetch);
async function init() {
await migrateDb();
await createUser("max");
const openapi = await router.request("/openapi.json");
const json = await openapi.text();
Deno.writeTextFile("openapi.json", json);
await createUser("max");
}
await init();