link-stack/packages/metamigo-db/scripts/dump-db.js

31 lines
574 B
JavaScript
Raw Normal View History

2023-02-13 12:41:30 +00:00
const { spawn } = require("child_process");
if (process.env.CI) {
process.exit(0);
}
const connectionString = process.env.GM_DBURL;
if (!connectionString) {
console.error(
"This script should only be called from a graphile-migrate action."
);
process.exit(1);
}
spawn(
process.env.PG_DUMP || "pg_dump",
[
"--no-sync",
"--schema-only",
"--no-owner",
"--exclude-schema=graphile_migrate",
"--exclude-schema=graphile_worker",
2023-06-21 12:48:07 +00:00
`--file=../../data/schema.sql`,
2023-02-13 12:41:30 +00:00
connectionString,
],
{
stdio: "inherit",
shell: true,
}
);