Adds logging of the station manifest to the DB (#90993)

## About The Pull Request
This adds a `manifest` table to the database, basically a databasified
version of the `manifest.txt` log.

## Why It's Good For The Game
This is less of a game feature and more of an admin & Statbus tool. We
currently do not have a good way to see who played which character in a
given round. This aims to fix that.

~~Drafted because I'm not sure on some of the typecasting for the
`special` and `latejoin` columns, I would like someone to give that a
once-over.~~ We good.
This commit is contained in:
Nick
2025-05-10 22:54:19 +00:00
committed by GitHub
parent 6aafe493d8
commit 4e16eb111d
5 changed files with 99 additions and 2 deletions

View File

@@ -5,14 +5,35 @@ Make sure to also update `DB_MAJOR_VERSION` and `DB_MINOR_VERSION`, which can be
The latest database version is 5.28; The query to update the schema revision table is:
```sql
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 30);
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 31);
```
or
```sql
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 30);
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 31);
```
In any query remember to add a prefix to the table names if you use one.
-----------------------------------------------------
Version 5.30, 3 May 2025, by Atlanta-Ned
Adds a `manifest` table.
```sql
CREATE TABLE `manifest` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server_ip` int(10) unsigned NOT NULL,
`server_port` smallint(5) NOT NULL,
`round_id` int(11) NOT NULL,
`ckey` text NOT NULL,
`character` text NOT NULL,
`job` text NOT NULL,
`special` text DEFAULT NULL,
`latejoin` tinyint(1) NOT NULL DEFAULT 0,
`timestamp` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
```
-----------------------------------------------------
Version 5.30, 1 May 2025, by Rengan
Adds `crime_desc` field to the `citation` table to save the description of the crime.

View File

@@ -293,6 +293,28 @@ CREATE TABLE `library_action` (
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `manifest`
--
DROP TABLE IF EXISTS `manifest`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `manifest` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server_ip` int(10) unsigned NOT NULL,
`server_port` smallint(5) NOT NULL,
`round_id` int(11) NOT NULL,
`ckey` text NOT NULL,
`character` text NOT NULL,
`job` text NOT NULL,
`special` text DEFAULT NULL,
`latejoin` tinyint(1) NOT NULL DEFAULT 0,
`timestamp` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `messages`
--

View File

@@ -292,6 +292,28 @@ CREATE TABLE `SS13_library_action` (
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SS13_manifest`
--
DROP TABLE IF EXISTS `SS13_manifest`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `SS13_manifest` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server_ip` int(10) unsigned NOT NULL,
`server_port` smallint(5) NOT NULL,
`round_id` int(11) NOT NULL,
`ckey` text NOT NULL,
`character` text NOT NULL,
`job` text NOT NULL,
`special` text DEFAULT NULL,
`latejoin` tinyint(1) NOT NULL DEFAULT 0,
`timestamp` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `SS13_messages`
--

View File

@@ -4,3 +4,4 @@
logger.Log(LOG_CATEGORY_MANIFEST, message, list(
"mind" = mind, "body" = body, "latejoin" = latejoin
))
SSblackbox.ReportManifest(ckey, body.real_name, mind.assigned_role.title, mind.special_role, latejoin)

View File

@@ -415,3 +415,34 @@ Versioning
if(query_report_citation)
query_report_citation.Execute(async = TRUE)
qdel(query_report_citation)
/datum/controller/subsystem/blackbox/proc/ReportManifest(ckey, character, job, special, latejoin)
var/datum/db_query/query_report_manifest = SSdbcore.NewQuery({"INSERT INTO [format_table_name("manifest")]
(server_ip,
server_port,
round_id,
ckey,
character,
job,
special,
latejoin) VALUES (
INET_ATON(:server_ip,
:port,
:round_id,
:ckey,
:character,
:job,
:special,
:latejoin)
"}, list(
"server_ip" = world.internet_address || "0",
"port" = "[world.port]",
"round_id" = GLOB.round_id,
"ckey" = ckey,
"job" = job,
"special" = special,
"latejoin" = latejoin
))
if(query_report_manifest)
query_report_manifest.Execute(async = TRUE)
qdel(query_report_manifest)