Skip to content

Commit a6962a8

Browse files
authored
fix(mysql): quote groups reserved word in query replacer (#4580)
`groups` is a reserved word in MySQL >= 8.0.2, causing migration 13 to fail with a syntax error on `ALTER TABLE password ADD COLUMN groups`. Fixes #4579 Signed-off-by: Michiel De Backker <mail@backkem.me>
1 parent 0963bbe commit a6962a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

storage/sql/sql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ var (
9595
// For compound indexes (with two keys) even less.
9696
{matchLiteral("text"), "varchar(384)"},
9797
// Quote keywords and reserved words used as identifiers.
98-
{regexp.MustCompile(`\b(keys)\b`), "`$1`"},
98+
{regexp.MustCompile(`\b(keys|groups)\b`), "`$1`"},
9999
// Change default timestamp to fit datetime.
100100
{regexp.MustCompile(`0001-01-01 00:00:00 UTC`), "1000-01-01 00:00:00"},
101101
},

0 commit comments

Comments
 (0)