Skip to content

Commit d29245e

Browse files
committed
prepare db with better output
1 parent c712ce0 commit d29245e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/backend/src/scripts/execsql.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ export async function runSQLFile(filePath: string) {
1010
try {
1111
await client.connect();
1212
const sql = await readFile(filePath, { encoding: 'utf8' });
13-
await client.query(sql);
14-
console.log(`Executed SQL file: ${filePath}`);
13+
console.log(`Executing SQL file: ${filePath}.\n${sql}`);
14+
const result = await client.query(sql);
15+
console.log(
16+
`rowcount:${result.rowCount}\n${JSON.stringify(result.rows, null, 2)}`,
17+
);
1518
} catch (err) {
1619
console.error(`Error executing SQL file ${filePath}:`, err);
1720
} finally {

0 commit comments

Comments
 (0)