Skip to content

Commit

Permalink
Fixed unhelpful error message when running migrations
Browse files Browse the repository at this point in the history
When the migration SQL code is missing a `;`, we  get
an error regarding an unexpected `INSERT INTO`. The user will
be confused when the migration isn't even containing any `INSERT TO`
calls at all.

To fix this we terminate the current statement by force adding a `;`
  • Loading branch information
mpscholten committed Aug 8, 2023
1 parent 6f3e268 commit 9f54047
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion IHP/SchemaMigration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ runMigration migration@Migration { revision, migrationFile } = do

let fullSql = [trimming|
BEGIN;
${migrationSql}
${migrationSql};
INSERT INTO schema_migrations (revision) VALUES (?);
COMMIT;
|]
Expand Down

0 comments on commit 9f54047

Please sign in to comment.