import getPGAsync from "../server/plugins/pg/funcs/getPGAsync.js"; import executeAllMigrations from "../server/plugins/migration/exec.migrations.all.js"; if (import.meta.main) { migrate(); } function close(pg: any) { if (pg && !pg.ending && !pg.ended) { pg.end(); } } export default async function migrate() { const pg = await getPGAsync(); await executeAllMigrations(pg).catch((err) => { close(pg); console.error("migrations error", err.toString()); process.exit(1); }); close(pg); process.exit(0); }