Chore: Enable ANSI_QUOTES for Mysql Database (#53277)

* remove the quote dialect

* add environment variable
This commit is contained in:
ying-jeanne
2022-08-08 11:14:17 -05:00
committed by GitHub
parent 732c22ed02
commit ba89471598
3 changed files with 17 additions and 1 deletions

View File

@ -28,9 +28,13 @@ func MySQLTestDB() TestDB {
if port == "" {
port = "3306"
}
conn_str := fmt.Sprintf("grafana:password@tcp(%s:%s)/grafana_tests?collation=utf8mb4_unicode_ci", host, port)
if _, present := os.LookupEnv("MYSQL_ANSI_QUOTES"); present {
conn_str += "&sql_mode='ANSI_QUOTES'"
}
return TestDB{
DriverName: "mysql",
ConnStr: fmt.Sprintf("grafana:password@tcp(%s:%s)/grafana_tests?collation=utf8mb4_unicode_ci", host, port),
ConnStr: conn_str,
}
}