You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
MySQL - migrate fails if ANSI or ANSI_QUOTES sql_mode is set with the following message:
error: Error 1064: 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 '"schema_migrations"' at line 1 in line 0: SHOW TABLES LIKE "schema_migrations"
Steps to Reproduce
Steps to reproduce the behavior:
Set sql_mode on a mysql database to ANSI or ANSI_QUOTES
Try to run migrate up
Migrate fails to find the version tables and exits before doing anything
Expected Behavior
Migrate should just run normally and apply the migrations.
Treat " as an identifier quote character (like the quote character) and not as a string quote character. You can still use to quote identifiers with this mode enabled. With ANSI_QUOTES enabled, you cannot use double quotation marks to quote literal strings because they are interpreted as identifiers.
Describe the Bug
MySQL - migrate fails if ANSI or ANSI_QUOTES sql_mode is set with the following message:
Steps to Reproduce
Steps to reproduce the behavior:
ANSI
orANSI_QUOTES
migrate up
Expected Behavior
Migrate should just run normally and apply the migrations.
Migrate Version
v4.13.0
Additional context
The behavior of double quotes (
"
) is different depending on the sql_mode that is set on a server (https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_ansi_quotes). In particular ifANSI_QUOTES
is set:As a consequence
migrate/database/mysql/mysql.go
Line 452 in 5d84bec
"
by'
as suggested in https://stackoverflow.com/a/14123649 (as it is done here).The text was updated successfully, but these errors were encountered: