import { execSync } from "node:child_process"; import { assertTestDatabase } from "./guard.js"; /** * Applies pending migrations to the test database (non-destructive). Tests truncate tables between cases, * so they refuse to run unless the database name ends in `_test`. */ export default function setup(): void { const url = assertTestDatabase(process.env.DATABASE_URL_TEST); execSync("npx prisma migrate deploy", { stdio: "inherit", env: { ...process.env, DATABASE_URL: url } }); }