From 6bc9bcf15a5a431373b8e9d33117db87898f8f7f Mon Sep 17 00:00:00 2001 From: JJ <3617814+joligario@users.noreply.github.com> Date: Sun, 11 Feb 2024 17:59:48 -0500 Subject: [PATCH] [Database] Proper default for `droptime` from `object_contents` (#4061) --- common/database/database_update_manifest.cpp | 10 ++++++++++ .../base/base_object_contents_repository.h | 2 +- common/version.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/database/database_update_manifest.cpp b/common/database/database_update_manifest.cpp index f5d5d4240..7339d9d61 100644 --- a/common/database/database_update_manifest.cpp +++ b/common/database/database_update_manifest.cpp @@ -5355,6 +5355,16 @@ CREATE TABLE guild_tributes ( .sql = R"( ALTER TABLE `character_corpses` MODIFY COLUMN `time_of_death` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP; )" + }, + ManifestEntry{ + .version = 9262, + .description = "2024_02_11_object_contents.sql", + .check = "SHOW COLUMNS FROM `object_contents` LIKE 'droptime'", + .condition = "contains", + .match = "0000-00-00 00:00:00", + .sql = R"( +ALTER TABLE `character_corpses` MODIFY COLUMN `droptime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP; + )" } // -- template; copy/paste this when you need to create a new entry // ManifestEntry{ diff --git a/common/repositories/base/base_object_contents_repository.h b/common/repositories/base/base_object_contents_repository.h index e4198efb3..d3bf93f3d 100644 --- a/common/repositories/base/base_object_contents_repository.h +++ b/common/repositories/base/base_object_contents_repository.h @@ -116,7 +116,7 @@ public: e.bagidx = 0; e.itemid = 0; e.charges = 0; - e.droptime = 0; + e.droptime = std::time(nullptr); e.augslot1 = 0; e.augslot2 = 0; e.augslot3 = 0; diff --git a/common/version.h b/common/version.h index 7906d27eb..36e9410bf 100644 --- a/common/version.h +++ b/common/version.h @@ -42,7 +42,7 @@ * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9261 +#define CURRENT_BINARY_DATABASE_VERSION 9262 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9042 #endif