From 5e6f87b162041cc51662953c6bc6c370bff3e583 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 30 Nov 2023 20:09:36 -0500 Subject: [PATCH] [Database] Modify `updated` column in `items` table with proper default. From https://mariadb.com/kb/en/datetime/, `datetime` can be ZERO_DATE (`0000-00-00` with no time component) or between `1000-01-01 00:00:00.000000` and `9999-12-31 23:59:59.999999`. Currently, `updated` is the only datetime field that is `NOT NULL` and improperly defaulted to `0000-00-00 00:00:00`. This change matches existing structures of the other `datetime` columns. --- common/database/database_update_manifest.cpp | 16 +++++++++++++--- common/version.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common/database/database_update_manifest.cpp b/common/database/database_update_manifest.cpp index 41fc6e338..a95d90cb4 100644 --- a/common/database/database_update_manifest.cpp +++ b/common/database/database_update_manifest.cpp @@ -5029,8 +5029,8 @@ ALTER TABLE `spawnentry` ADD COLUMN `min_time` smallint(4) NOT NULL DEFAULT 0 AFTER `condition_value_filter`, ADD COLUMN `max_time` smallint(4) NOT NULL DEFAULT 0 AFTER `min_time`; )" - }, - ManifestEntry{ + }, + ManifestEntry{ .version = 9243, .description = "2023_11_27_starting_items_revamp.sql", .check = "SHOW COLUMNS FROM `starting_items` LIKE 'race_list'", @@ -5083,8 +5083,18 @@ INSERT INTO DROP TABLE `starting_items`; RENAME TABLE `starting_items_new` TO `starting_items`; )" - + }, + ManifestEntry{ + .version = 9244, + .description = "2023_11_30_items_table_schema.sql", + .check = "SHOW COLUMNS FROM `items` LIKE 'updated'", + .condition = "contains", + .match = "NULL", + .sql = R"( +ALTER TABLE `items` MODIFY COLUMN `updated` datetime NULL DEFAULT NULL; + )" } + // -- template; copy/paste this when you need to create a new entry // ManifestEntry{ // .version = 9228, diff --git a/common/version.h b/common/version.h index b955d45ad..c602e7cc3 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 9243 +#define CURRENT_BINARY_DATABASE_VERSION 9244 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9040