Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HT6iXLYUUp9pJz5Kza9xCW
12 lines
493 B
TypeScript
12 lines
493 B
TypeScript
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 } });
|
|
}
|