rust-db / refinery

Powerful SQL migration toolkit for Rust.
MIT License
1.35k stars 126 forks source link

MySQL migration succeeds despite syntax error in `.sql` file #343

Open zackangelo opened 4 months ago

zackangelo commented 4 months ago

When running an initial migration to execute a series of CREATE TABLE statements for MySQL, I noticed that I was missing a semicolon. The migration reported as a success even though the .sql migration file had a syntax error. It just created a couple of the tables in the file and ignored the rest.

When I pipe the .sql file directly into mysql it reports the syntax error as expected. Is this intended behavior? Am I organizing my migration files wrong?

zackangelo commented 4 months ago

Upon some further inspection, it seems this is only a problem with the mysql driver. It reports the syntax error correctly and fails the migration when I use mysql_async.

failable commented 4 months ago

Same issue when mysql and CREATE TABLE.

jxs commented 4 months ago

Hi, and thanks for the interest! Interesting, does the sql query also succeed if you run it directly with mysql ?