graphile/migrate

Query logging

Opened this issue · 1 comments

Right now if there is an error it is really hard to track down which specific line caused the sql error (even something as basic as syntax). Would love to have logging for every statement that is executed and highlight for the problematic statements.

benjie commented

Graphile Migrate reads the file on the disk and then issues it to the database, it does not parse it and split it into individual statements (doing so is more complex than you might think thanks to the $<blah>$ string delimiters that Postgres uses). If the error comes back with details, we do try and tie those back to the relevant line in the source (see https://github.com/graphile/migrate/blob/main/src/instrumentation.ts ) but we can only do that when there's enough data.

Further, we don't currently support this well when you're using a current/ folder rather than a current.sql file - we effectively turn the current/ folder into a single SQL string and then locate the error in that - we don't currently map it back to the separate files.