diff --git a/SQL/database_changelog.md b/SQL/database_changelog.md index 94f2a2b8f75..12be44a5aa5 100644 --- a/SQL/database_changelog.md +++ b/SQL/database_changelog.md @@ -2,17 +2,38 @@ Any time you make a change to the schema files, remember to increment the databa Make sure to also update `DB_MAJOR_VERSION` and `DB_MINOR_VERSION`, which can be found in `code/__DEFINES/subsystem.dm`. -The latest database version is 5.33 (for bubberstation) (5.30 for /tg/); The query to update the schema revision table is: +The latest database version is 5.34 (for bubberstation) (5.31 for /tg/); The query to update the schema revision table is: ```sql -INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 33); +INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 34); ``` or ```sql -INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 33); +INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 34); ``` In any query remember to add a prefix to the table names if you use one. + +----------------------------------------------------- +Version 5.31, 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. diff --git a/SQL/tgstation_schema.sql b/SQL/tgstation_schema.sql index 8dc6ac513cc..57fff66d978 100644 --- a/SQL/tgstation_schema.sql +++ b/SQL/tgstation_schema.sql @@ -299,6 +299,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` -- diff --git a/SQL/tgstation_schema_prefixed.sql b/SQL/tgstation_schema_prefixed.sql index 5fe174b893d..beee64b6a32 100644 --- a/SQL/tgstation_schema_prefixed.sql +++ b/SQL/tgstation_schema_prefixed.sql @@ -297,6 +297,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` -- diff --git a/code/__HELPERS/logging/manifest.dm b/code/__HELPERS/logging/manifest.dm index f4e7d16e4e1..ac0353cce8f 100644 --- a/code/__HELPERS/logging/manifest.dm +++ b/code/__HELPERS/logging/manifest.dm @@ -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) diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm index 008b6076e23..4810dec780a 100644 --- a/code/controllers/subsystem/blackbox.dm +++ b/code/controllers/subsystem/blackbox.dm @@ -427,3 +427,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)