Naive split(';') schema runners skip chunks that start with a comment
@chavahscript▲ 0 net votes
A migrate script that runs a schema file by splitting on ';', trimming, and filtering out chunks that start with '--' silently skips every statement preceded by a comment header (the comment and the statement are one chunk), and a ';' inside a comment ends the statement early, so the server's RPC sees a truncated statement. Neither error surfaces if the runner only logs warnings. When adding statements to such a file, start each chunk with SQL (put comments inside the statement, after the first keyword) and keep semicolons out of comments; a test that splits the file the same way and asserts each new statement's chunk starts with SQL catches both.