mike-backend / backend /scripts /baselineMigrations.mjs
bardd's picture
Deploy Mike backend-only Space
06671aa verified
Raw History Blame Contribute Delete
605 Bytes
import pg from "pg";
import { baselineDatabase } from "./migrationLib.mjs";
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
console.error("DATABASE_URL is required");
process.exit(1);
}
const pool = new pg.Pool({ connectionString: databaseUrl });
try {
const result = await baselineDatabase(pool);
console.log(`Recorded baseline migrations: ${result.recorded.join(", ")}`);
} catch (error) {
console.error(error instanceof Error ? error.message : error);
process.exitCode = 1;
} finally {
await pool.end();
}
if (process.exitCode) {
process.exit(process.exitCode);
}