From 08a8e6b57b358878a769d4cb62fa57fbe621e857 Mon Sep 17 00:00:00 2001 From: Codex Bot Date: Tue, 24 Mar 2026 01:03:07 +0100 Subject: [PATCH] Run explorer migration statements separately --- apps/indexer/src/migrate.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/indexer/src/migrate.ts b/apps/indexer/src/migrate.ts index 1b57846..94291d9 100644 --- a/apps/indexer/src/migrate.ts +++ b/apps/indexer/src/migrate.ts @@ -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; }); -