Run explorer migration statements separately

This commit is contained in:
Codex Bot
2026-03-24 01:03:07 +01:00
parent f8c0e84a40
commit 08a8e6b57b

View File

@@ -9,7 +9,15 @@ async function main() {
const pool = createPool();
const sqlPath = path.resolve(__dirname, "../migrations/001_init.sql");
const sql = await readFile(sqlPath, "utf8");
await pool.query(sql);
const statements = sql
.split(/;\s*\n/g)
.map((statement) => statement.trim())
.filter((statement) => statement.length > 0);
for (const statement of statements) {
await pool.query(statement);
}
await pool.end();
console.log(`Applied migration ${sqlPath}`);
}
@@ -18,4 +26,3 @@ main().catch((error) => {
console.error(error);
process.exitCode = 1;
});