sqlx-ts icon indicating copy to clipboard operation
sqlx-ts copied to clipboard

[BUG] The tool detects the errors but return exit code 0 and prints "[INFO] No SQL errors detected!"

Open ahmdssi opened this issue 1 year ago • 1 comments

The command: $ sqlx-ts . --db-type=postgres --db-host=localhost --db-port=5431 --db-user=<user> --db-pass=<password> && echo "Exit code is 0" reurns:

[INFO] Scanning "." for SQLs with extension Ts
error: internal compiler error: column "jwks_ur" of relation "applications" does not exist
  --> ./src/applications/applications.service.ts:18:5
   |
18 | /     const { rows } = await this.conn.query(
19 | |       sql`
20 | |         INSERT INTO applications (jwks_ur) VALUES ($1) RETURNING *;
21 | |       `,
22 | |       [createApplicationDto.jwksUri],
23 | |     );
   | |______^

[INFO] No SQL errors detected!
Exit code is 0

ahmdssi avatar Sep 27 '24 07:09 ahmdssi

Thanks for this, could you please tell me what version of sqlx-ts that you are using?

I am replicating the same query (It seems like you are not using -g flag)

Screen Shot 2024-10-05 at 9 57 43 am Screen Shot 2024-10-05 at 9 56 48 am

On the latest sqlx-ts, I am getting the exit code correctly, process.exit(1)

Also please let me know which database are you using. The command relies on whether or not the database correctly fails on the PREPARE/EXPLAIN query

JasonShin avatar Oct 04 '24 23:10 JasonShin