rust-db / refinery

Powerful SQL migration toolkit for Rust.
MIT License
1.3k stars 121 forks source link

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

Open zackangelo opened 1 month ago

zackangelo commented 1 month 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 1 month 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 1 month ago

Same issue when mysql and CREATE TABLE.

jxs commented 1 month ago

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