Browse Source

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>
pull/4604/head
Michiel De Backker 3 weeks ago committed by maksim.nabokikh
parent
commit
eaa45e2ca5
  1. 2
      storage/sql/sql.go

2
storage/sql/sql.go

@ -95,7 +95,7 @@ var (
// For compound indexes (with two keys) even less.
{matchLiteral("text"), "varchar(384)"},
// Quote keywords and reserved words used as identifiers.
{regexp.MustCompile(`\b(keys)\b`), "`$1`"},
{regexp.MustCompile(`\b(keys|groups)\b`), "`$1`"},
// Change default timestamp to fit datetime.
{regexp.MustCompile(`0001-01-01 00:00:00 UTC`), "1000-01-01 00:00:00"},
},

Loading…
Cancel
Save