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/4383/merge
Michiel De Backker 3 weeks ago committed by GitHub
parent
commit
a6962a8ba4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  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