mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-09 07:48:55 +00:00
update mentor admin log sql query
This commit is contained in:
@@ -5,10 +5,10 @@ CREATE TABLE `mentor_memo` (
|
||||
`last_editor` varchar(32) DEFAULT NULL,
|
||||
`edits` text,
|
||||
PRIMARY KEY (`ckey`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE `mentor` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
14
SQL/mentor_prefixed.sql
Normal file
14
SQL/mentor_prefixed.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
CREATE TABLE `SS13_mentor_memo` (
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
`memotext` text NOT NULL,
|
||||
`timestamp` datetime NOT NULL,
|
||||
`last_editor` varchar(32) DEFAULT NULL,
|
||||
`edits` text,
|
||||
PRIMARY KEY (`ckey`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
CREATE TABLE `SS13_mentor` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ckey` varchar(32) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
@@ -2778,10 +2778,17 @@
|
||||
if(query_get_mentor.NextRow())
|
||||
to_chat(usr, "<span class='danger'>[ckey] is already a mentor.</span>")
|
||||
return
|
||||
var/datum/db_query/query_add_mentor = SSdbcore.NewQuery("INSERT INTO `[format_table_name("mentor")]` (`id`, `ckey`) VALUES (null, '[ckey]')")
|
||||
var/datum/db_query/query_add_mentor = SSdbcore.NewQuery(
|
||||
"INSERT INTO [format_table_name("mentor")] (id, ckey) VALUES (:id, :ckey)",
|
||||
list("id" = null, "ckey" = ckey)
|
||||
)
|
||||
if(!query_add_mentor.warn_execute())
|
||||
return
|
||||
var/datum/db_query/query_add_admin_log = SSdbcore.NewQuery("INSERT INTO `[format_table_name("admin_log")]` (`id` ,`datetime` ,`adminckey` ,`adminip` ,`log` ) VALUES (NULL , NOW( ) , '[usr.ckey]', '[usr.client.address]', 'Added new mentor [ckey]');")
|
||||
var/datum/db_query/query_add_admin_log = SSdbcore.NewQuery({"
|
||||
INSERT INTO [format_table_name("admin_log")] (datetime, round_id, adminckey, adminip, operation, target, log)
|
||||
VALUES (:time, :round_id, :adminckey, INET_ATON(:adminip), 'add mentor', :mentor_ckey, CONCAT('Admin removed: ', :mentor_ckey))
|
||||
"}, list("time" = SQLtime(), "round_id" = "[GLOB.round_id]", "adminckey" = usr.ckey, "adminip" = usr.client.address, "mentor_ckey" = ckey)
|
||||
)
|
||||
if(!query_add_admin_log.warn_execute())
|
||||
return
|
||||
else
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
var/datum/db_query/update_query = SSdbcore.NewQuery({"
|
||||
UPDATE [format_table_name("mentor_memo")]
|
||||
SET memotext = :new_memo, last_editor = :ckey, edits = :edit_text WHERE ckey = :target_ckey
|
||||
"}, list("new_memo" = new_memo, "ckey" = ckey, "edit_text" = (edit_text ? "" : edit_text), "target_ckey" = target_ckey))
|
||||
"}, list("new_memo" = new_memo, "ckey" = ckey, "edit_text" = (edit_text || ""), "target_ckey" = target_ckey))
|
||||
if(!update_query.Execute())
|
||||
var/err = update_query.ErrorMsg()
|
||||
qdel(update_query)
|
||||
|
||||
Reference in New Issue
Block a user