Fixes rank being a reserved SQL keyword (#15661)

This commit is contained in:
AffectedArc07
2021-03-04 18:50:36 +00:00
committed by GitHub
parent 091146029a
commit fd79e342a8
9 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ckey` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`rank` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Administrator',
`admin_rank` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Administrator',
`level` int(2) NOT NULL DEFAULT '0',
`flags` int(16) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
+1 -1
View File
@@ -158,7 +158,7 @@ DROP TABLE IF EXISTS `SS13_admin`;
CREATE TABLE `SS13_admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ckey` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
`rank` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Administrator',
`admin_rank` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Administrator',
`level` int(2) NOT NULL DEFAULT '0',
`flags` int(16) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
+4
View File
@@ -0,0 +1,4 @@
# Updating DB from 21-22, -AffectedArc07
# Changes `rank` to `admin_rank` to remove use of reserved keyword
ALTER TABLE `admin` CHANGE COLUMN `rank` `admin_rank` VARCHAR(32) NOT NULL DEFAULT 'Administrator' COLLATE 'utf8mb4_unicode_ci' AFTER `ckey`;
+1 -1
View File
@@ -363,7 +363,7 @@
#define INVESTIGATE_BOMB "bombs"
// The SQL version required by this version of the code
#define SQL_VERSION 21
#define SQL_VERSION 22
// Vending machine stuff
#define CAT_NORMAL 1
+1 -1
View File
@@ -117,7 +117,7 @@ GLOBAL_PROTECT(admin_ranks) // this shit is being protected for obvious reasons
load_admins()
return
var/datum/db_query/query = SSdbcore.NewQuery("SELECT ckey, rank, level, flags FROM [format_table_name("admin")]")
var/datum/db_query/query = SSdbcore.NewQuery("SELECT ckey, admin_rank, level, flags FROM [format_table_name("admin")]")
if(!query.warn_execute(async=run_async))
qdel(query)
return
+2 -2
View File
@@ -696,7 +696,7 @@ GLOBAL_LIST_INIT(admin_verbs_ticket, list(
return
var/datum/db_query/rank_read = SSdbcore.NewQuery(
"SELECT rank FROM [format_table_name("admin")] WHERE ckey=:ckey",
"SELECT admin_rank FROM [format_table_name("admin")] WHERE ckey=:ckey",
list("ckey" = ckey)
)
@@ -722,7 +722,7 @@ GLOBAL_LIST_INIT(admin_verbs_ticket, list(
return
var/datum/db_query/admin_read = SSdbcore.NewQuery(
"SELECT ckey, rank, flags FROM [format_table_name("admin")] WHERE ckey=:ckey",
"SELECT ckey, admin_rank, flags FROM [format_table_name("admin")] WHERE ckey=:ckey",
list("ckey" = ckey)
)
@@ -90,7 +90,7 @@
qdel(select_query)
flag_account_for_forum_sync(adm_ckey)
if(new_admin)
var/datum/db_query/insert_query = SSdbcore.NewQuery("INSERT INTO [format_table_name("admin")] (`id`, `ckey`, `rank`, `level`, `flags`) VALUES (null, :adm_ckey, :new_rank, -1, 0)", list(
var/datum/db_query/insert_query = SSdbcore.NewQuery("INSERT INTO [format_table_name("admin")] (`id`, `ckey`, `admin_rank`, `level`, `flags`) VALUES (null, :adm_ckey, :new_rank, -1, 0)", list(
"adm_ckey" = adm_ckey,
"new_rank" = new_rank
))
@@ -113,7 +113,7 @@
to_chat(usr, "<span class='notice'>New admin added.</span>")
else
if(!isnull(admin_id) && isnum(admin_id))
var/datum/db_query/insert_query = SSdbcore.NewQuery("UPDATE [format_table_name("admin")] SET rank=:new_rank WHERE id=:admin_id", list(
var/datum/db_query/insert_query = SSdbcore.NewQuery("UPDATE [format_table_name("admin")] SET admin_rank=:new_rank WHERE id=:admin_id", list(
"new_rank" = new_rank,
"admin_id" = admin_id,
))
+1 -1
View File
@@ -9,7 +9,7 @@
## This value must be set to the version of the paradise schema in use.
## If this value does not match, the SQL database will not be loaded and an error will be generated.
## Roundstart will be delayed.
DB_VERSION 21
DB_VERSION 22
## Server the MySQL database can be found at.
# Examples: localhost, 200.135.5.43, www.mysqldb.com, etc.
+1 -1
View File
@@ -2,7 +2,7 @@
# Dont use it ingame
# Remember to update this when you increase the SQL version! -aa
SQL_ENABLED
DB_VERSION 21
DB_VERSION 22
ADDRESS 127.0.0.1
PORT 3306
FEEDBACK_DATABASE feedback