2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-22 02:02:14 +00:00

added backticks around "groups" in all schemas and queries, as it is a reserved keyword as of mysql 8.0

This commit is contained in:
nspadaccino 2024-10-02 15:56:23 -04:00
parent d0aea448ae
commit b31923e91f
No known key found for this signature in database
GPG Key ID: AB060C9A2C68918E
3 changed files with 12 additions and 12 deletions

View File

@ -2,6 +2,6 @@ CREATE SCHEMA IF NOT EXISTS ${dbName};
USE ${dbName};
ALTER TABLE groups ADD COLUMN description VARCHAR(256) NULL;
ALTER TABLE groups ADD COLUMN created_timestamp DATETIME NOT NULL;
ALTER TABLE groups ADD COLUMN email VARCHAR(256) NOT NULL;
ALTER TABLE `groups` ADD COLUMN description VARCHAR(256) NULL;
ALTER TABLE `groups` ADD COLUMN created_timestamp DATETIME NOT NULL;
ALTER TABLE `groups` ADD COLUMN email VARCHAR(256) NOT NULL;

View File

@ -5,7 +5,7 @@ USE ${dbName};
/*
Create table to store groups
*/
CREATE TABLE groups (
CREATE TABLE `groups` (
id CHAR(36) NOT NULL,
name VARCHAR(256) NOT NULL,
data BLOB NOT NULL,

View File

@ -32,47 +32,47 @@ class MySqlGroupRepository extends GroupRepository with GroupProtobufConversions
private final val PUT_GROUP =
sql"""
|REPLACE INTO groups(id, name, data, description, created_timestamp, email)
|REPLACE INTO `groups`(id, name, data, description, created_timestamp, email)
| VALUES ({id}, {name}, {data}, {description}, {createdTimestamp}, {email})
""".stripMargin
private final val DELETE_GROUP =
sql"""
|DELETE FROM groups
|DELETE FROM `groups`
| WHERE id = ?
""".stripMargin
private final val GET_GROUP_BY_ID =
sql"""
|SELECT data
| FROM groups
| FROM `groups`
| WHERE id = ?
""".stripMargin
private final val GET_GROUP_BY_NAME =
sql"""
|SELECT data
| FROM groups
| FROM `groups`
| WHERE name = ?
""".stripMargin
private final val GET_ALL_GROUPS =
sql"""
|SELECT data
| FROM groups
| FROM `groups`
""".stripMargin
private val BASE_GET_GROUPS_BY_IDS =
"""
|SELECT data
| FROM groups
| FROM `groups`
| WHERE id
""".stripMargin
private val BASE_GET_GROUPS_BY_NAMES =
"""
|SELECT data
| FROM groups
| FROM `groups`
| WHERE name
""".stripMargin
@ -187,7 +187,7 @@ class MySqlGroupRepository extends GroupRepository with GroupProtobufConversions
monitor("repo.Group.getGroupByName") {
IO {
logger.debug(s"Getting groups with name: $nameFilter")
val initialQuery = "SELECT data FROM groups WHERE name"
val initialQuery = "SELECT data FROM `groups` WHERE name"
val sb = new StringBuilder
sb.append(initialQuery)
val groupsLike = if (nameFilter.contains('*')) {