fix: require migration database source
This commit is contained in:
@@ -851,7 +851,9 @@ function externalPostgresMigrationRunner() {
|
||||
'const { Pool } = require("/opt/hwlab-env/node_modules/pg");',
|
||||
'const root = "/opt/hwlab-migrations";',
|
||||
'const files = (await readdir(root)).filter((name) => /^\\d+_.*\\.sql$/u.test(name)).sort();',
|
||||
'const pool = new Pool({ connectionString: process.env.DATABASE_URL, max: 1 });',
|
||||
'const connectionString = process.env.DATABASE_URL;',
|
||||
'if (!connectionString) throw new Error("DATABASE_URL is required");',
|
||||
'const pool = new Pool({ connectionString, max: 1 });',
|
||||
'try {',
|
||||
' for (const file of files) {',
|
||||
' await pool.query(await readFile(`${root}/${file}`, "utf8"));',
|
||||
|
||||
Reference in New Issue
Block a user