erikbra / grate

grate - the SQL scripts migration runner
MIT License
205 stars 39 forks source link

v1.8.0 MariaDB/MySQL fix casing scripts seem to break with MySQL #569

Open vilma-heikkila opened 3 months ago

vilma-heikkila commented 3 months ago

Describe the bug With 1.8.0 came a bug fix for schemas/tables with different casings (#557). However, the scripts use "ALTER TABLE IF EXISTS" syntax which doesn't seem to exist in MySQL, only in MariaDB. This breaks the database migration. The documentation says that grate supports MariaDB/MySQL, but in this specific case it doesn't. :)

To Reproduce

Have a MySQL server Run grate -cs "XXX" --dbt "mariadb" --files "XXX"

Error occurs:

An error occurred: Migration failed due to the following errors:

Update ("up"):
--------------------------------------------------------------------------------
grate-internal\00_02_fix_version_table_casing.sql: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS `grate_grateversion`
RENAME TO `grate_GrateVersion`' at line 1

Expected behavior The script should not break the database migration.

Desktop (please complete the following information):

twerthi commented 1 month ago

I'm running into this as well on MySQL instances.

misterjunio commented 3 weeks ago

+1. Are there any known workarounds? This basically makes the latest Grate version 1.8.0 (and future ones if not fixed) unusable for MySQL :/