import { fileURLToPath } from "node:url" import { migrate } from "drizzle-orm/postgres-js/migrator" import { createDb } from "../src/db/client.js" import { testDatabaseUrl } from "./helpers.js" /** Applica le migrazioni al DB di test prima di tutti i test. */ export default async function setup() { const { db, close } = createDb(testDatabaseUrl(), { max: 1 }) try { await migrate(db, { migrationsFolder: fileURLToPath(new URL("../src/db/migrations", import.meta.url)) }) } finally { await close() } }