Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions sql-files/logs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

CREATE TABLE IF NOT EXISTS `atcommandlog` (
`atcommand_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
`atcommand_date` DATETIME NULL,
`atcommand_date` TIMESTAMP NULL,
`account_id` INT UNSIGNED NOT NULL DEFAULT '0',
`char_id` INT UNSIGNED NOT NULL DEFAULT '0',
`char_name` VARCHAR(25) NOT NULL DEFAULT '',
Expand All @@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS `atcommandlog` (

CREATE TABLE IF NOT EXISTS `branchlog` (
`branch_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
`branch_date` DATETIME NULL,
`branch_date` TIMESTAMP NULL,
`account_id` INT NOT NULL DEFAULT '0',
`char_id` INT NOT NULL DEFAULT '0',
`char_name` VARCHAR(25) NOT NULL DEFAULT '',
Expand All @@ -76,7 +76,7 @@ CREATE TABLE IF NOT EXISTS `branchlog` (

CREATE TABLE IF NOT EXISTS `chatlog` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`time` DATETIME NULL,
`time` TIMESTAMP NULL,
`type` ENUM('O','W','P','G','M','C') NOT NULL DEFAULT 'O',
`type_id` INT NOT NULL DEFAULT '0',
`src_charid` INT NOT NULL DEFAULT '0',
Expand All @@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS `chatlog` (
--

CREATE TABLE IF NOT EXISTS `loginlog` (
`time` DATETIME NULL,
`time` TIMESTAMP NULL,
`ip` VARCHAR(15) NOT NULL DEFAULT '',
`user` VARCHAR(23) NOT NULL DEFAULT '',
`rcode` TINYINT NOT NULL DEFAULT '0',
Expand All @@ -110,7 +110,7 @@ CREATE TABLE IF NOT EXISTS `loginlog` (

CREATE TABLE IF NOT EXISTS `mvplog` (
`mvp_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
`mvp_date` DATETIME NULL,
`mvp_date` TIMESTAMP NULL,
`kill_char_id` INT NOT NULL DEFAULT '0',
`monster_id` SMALLINT NOT NULL DEFAULT '0',
`prize` INT NOT NULL DEFAULT '0',
Expand All @@ -125,7 +125,7 @@ CREATE TABLE IF NOT EXISTS `mvplog` (

CREATE TABLE IF NOT EXISTS `npclog` (
`npc_id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
`npc_date` DATETIME NULL,
`npc_date` TIMESTAMP NULL,
`account_id` INT UNSIGNED NOT NULL DEFAULT '0',
`char_id` INT UNSIGNED NOT NULL DEFAULT '0',
`char_name` VARCHAR(25) NOT NULL DEFAULT '',
Expand All @@ -142,7 +142,7 @@ CREATE TABLE IF NOT EXISTS `npclog` (

CREATE TABLE IF NOT EXISTS `picklog` (
`id` INT NOT NULL AUTO_INCREMENT,
`time` DATETIME NULL,
`time` TIMESTAMP NULL,
`char_id` INT NOT NULL DEFAULT '0',
`type` ENUM('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U','K','Y','Z','W','Q','J','H','@','0','1','2','3','4','5') NOT NULL DEFAULT 'P',
`nameid` INT NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -175,7 +175,7 @@ CREATE TABLE IF NOT EXISTS `picklog` (

CREATE TABLE IF NOT EXISTS `zenylog` (
`id` INT NOT NULL AUTO_INCREMENT,
`time` DATETIME NULL,
`time` TIMESTAMP NULL,
`char_id` INT NOT NULL DEFAULT '0',
`src_id` INT NOT NULL DEFAULT '0',
`type` ENUM('T','V','P','M','S','N','D','C','A','E','I','B','K','4','5') NOT NULL DEFAULT 'S',
Expand Down
75 changes: 38 additions & 37 deletions sql-files/main.sql
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ CREATE TABLE IF NOT EXISTS `char` (
`option` INT NOT NULL DEFAULT '0',
`karma` TINYINT NOT NULL DEFAULT '0',
`manner` SMALLINT NOT NULL DEFAULT '0',
`party_id` INT UNSIGNED NOT NULL DEFAULT '0',
`guild_id` INT UNSIGNED NOT NULL DEFAULT '0',
`clan_id` INT UNSIGNED NOT NULL DEFAULT '0',
`pet_id` INT UNSIGNED NOT NULL DEFAULT '0',
`homun_id` INT UNSIGNED NOT NULL DEFAULT '0',
`elemental_id` INT UNSIGNED NOT NULL DEFAULT '0',
`party_id` INT UNSIGNED NULL DEFAULT NULL,
`guild_id` INT UNSIGNED NULL DEFAULT NULL,
`clan_id` INT UNSIGNED NULL DEFAULT NULL,
`pet_id` INT UNSIGNED NULL DEFAULT NULL,
`homun_id` INT UNSIGNED NULL DEFAULT NULL,
`elemental_id` INT UNSIGNED NULL DEFAULT NULL,
`hair` TINYINT UNSIGNED NOT NULL DEFAULT '0',
`hair_color` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
`clothes_color` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
Expand All @@ -223,18 +223,18 @@ CREATE TABLE IF NOT EXISTS `char` (
`head_mid` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
`head_bottom` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
`robe` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
`last_login` BIGINT NULL DEFAULT '0',
`last_login` TIMESTAMP NULL DEFAULT NULL,
`last_map` VARCHAR(11) NOT NULL DEFAULT '',
`last_x` SMALLINT UNSIGNED NOT NULL DEFAULT '53',
`last_y` SMALLINT UNSIGNED NOT NULL DEFAULT '111',
`save_map` VARCHAR(11) NOT NULL DEFAULT '',
`save_x` SMALLINT UNSIGNED NOT NULL DEFAULT '53',
`save_y` SMALLINT UNSIGNED NOT NULL DEFAULT '111',
`partner_id` INT UNSIGNED NOT NULL DEFAULT '0',
`partner_id` INT UNSIGNED NULL DEFAULT NULL,
`online` TINYINT NOT NULL DEFAULT '0',
`father` INT UNSIGNED NOT NULL DEFAULT '0',
`mother` INT UNSIGNED NOT NULL DEFAULT '0',
`child` INT UNSIGNED NOT NULL DEFAULT '0',
`father` INT UNSIGNED NULL DEFAULT NULL,
`mother` INT UNSIGNED NULL DEFAULT NULL,
`child` INT UNSIGNED NULL DEFAULT NULL,
`fame` INT UNSIGNED NOT NULL DEFAULT '0',
`rename` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
`delete_date` INT UNSIGNED NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -287,22 +287,22 @@ CREATE TABLE IF NOT EXISTS `char_reg_str_db` (
--

CREATE TABLE IF NOT EXISTS `charlog` (
`time` DATETIME NULL,
`char_msg` VARCHAR(255) NOT NULL DEFAULT 'char select',
`account_id` INT NOT NULL DEFAULT '0',
`char_id` INT UNSIGNED NOT NULL DEFAULT '0',
`char_num` TINYINT NOT NULL DEFAULT '0',
`class` MEDIUMINT NOT NULL DEFAULT '0',
`name` VARCHAR(23) NOT NULL DEFAULT '',
`str` INT UNSIGNED NOT NULL DEFAULT '0',
`agi` INT UNSIGNED NOT NULL DEFAULT '0',
`vit` INT UNSIGNED NOT NULL DEFAULT '0',
`int` INT UNSIGNED NOT NULL DEFAULT '0',
`dex` INT UNSIGNED NOT NULL DEFAULT '0',
`luk` INT UNSIGNED NOT NULL DEFAULT '0',
`hair` TINYINT NOT NULL DEFAULT '0',
`hair_color` INT NOT NULL DEFAULT '0'
) ENGINE=MyISAM;
`time` TIMESTAMP NULL,
`char_msg` VARCHAR(255) NOT NULL DEFAULT 'char select',
`account_id` INT NOT NULL DEFAULT '0',
`char_id` INT UNSIGNED NOT NULL DEFAULT '0',
`char_num` TINYINT NOT NULL DEFAULT '0',
`class` MEDIUMINT NOT NULL DEFAULT '0',
`name` VARCHAR(23) NOT NULL DEFAULT '',
`str` INT UNSIGNED NOT NULL DEFAULT '0',
`agi` INT UNSIGNED NOT NULL DEFAULT '0',
`vit` INT UNSIGNED NOT NULL DEFAULT '0',
`int` INT UNSIGNED NOT NULL DEFAULT '0',
`dex` INT UNSIGNED NOT NULL DEFAULT '0',
`luk` INT UNSIGNED NOT NULL DEFAULT '0',
`hair` TINYINT NOT NULL DEFAULT '0',
`hair_color` INT NOT NULL DEFAULT '0'
) ENGINE=MyISAM;

--
-- Table structure for table `elemental`
Expand Down Expand Up @@ -577,9 +577,9 @@ CREATE TABLE IF NOT EXISTS `homunculus` (
--

CREATE TABLE IF NOT EXISTS `interlog` (
`time` DATETIME NULL,
`log` VARCHAR(255) NOT NULL DEFAULT ''
) ENGINE=MyISAM;
`time` TIMESTAMP NULL,
`log` VARCHAR(255) NOT NULL DEFAULT ''
) ENGINE=MyISAM;

--
-- Table structure for table `inventory`
Expand Down Expand Up @@ -622,12 +622,12 @@ CREATE TABLE IF NOT EXISTS `inventory` (
--

CREATE TABLE IF NOT EXISTS `ipbanlist` (
`list` VARCHAR(39) NOT NULL DEFAULT '',
`btime` DATETIME NULL,
`rtime` DATETIME NULL,
`reason` VARCHAR(255) NOT NULL DEFAULT '',
KEY (`list`)
) ENGINE=InnoDB;
`list` VARCHAR(39) NOT NULL DEFAULT '',
`btime` TIMESTAMP NULL,
`rtime` TIMESTAMP NULL,
`reason` VARCHAR(255) NOT NULL DEFAULT '',
KEY (`list`)
) ENGINE=InnoDB;

--
-- Table structure for table `login`
Expand All @@ -644,7 +644,7 @@ CREATE TABLE IF NOT EXISTS `login` (
`unban_time` INT UNSIGNED NOT NULL DEFAULT '0',
`expiration_time` INT UNSIGNED NOT NULL DEFAULT '0',
`logincount` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
`lastlogin` DATETIME NULL,
`lastlogin` TIMESTAMP NULL,
`last_ip` VARCHAR(100) NOT NULL DEFAULT '',
`birthdate` DATE NULL,
`character_slots` TINYINT UNSIGNED NOT NULL DEFAULT '0',
Expand Down Expand Up @@ -967,6 +967,7 @@ INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1599908598); -- 2020-09-1
INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1613840320); -- 2021-02-20--19-57.sql
INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1618058468); -- 2021-04-10--15-36.sql
INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1653155461); -- 2022-05-21--29-49.sql
INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1725211254); -- 2025-09-01--17-20.sql

--
-- Table structure for table `storage`
Expand Down
55 changes: 55 additions & 0 deletions sql-files/upgrades/2025-09-01--17-20.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#1725211254

-- This file is part of Hercules.
-- http://herc.ws - http://github.com/HerculesWS/Hercules
--
-- Copyright (C) 2025 Hercules Dev Team
--
-- Hercules is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

-- SQL date/time fields and general improvements

-- Convert DATETIME to TIMESTAMP for timezone support
ALTER TABLE `charlog` MODIFY `time` TIMESTAMP NULL;
ALTER TABLE `interlog` MODIFY `time` TIMESTAMP NULL;
ALTER TABLE `ipbanlist` MODIFY `btime` TIMESTAMP NULL;
ALTER TABLE `ipbanlist` MODIFY `rtime` TIMESTAMP NULL;
ALTER TABLE `login` MODIFY `lastlogin` TIMESTAMP NULL;

-- Convert BIGINT to TIMESTAMP for last_login
ALTER TABLE `char` MODIFY `last_login` TIMESTAMP NULL DEFAULT NULL;

-- Allow NULL for optional IDs
ALTER TABLE `char` MODIFY `party_id` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `guild_id` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `clan_id` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `pet_id` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `homun_id` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `elemental_id` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `partner_id` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `father` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `mother` INT UNSIGNED NULL DEFAULT NULL;
ALTER TABLE `char` MODIFY `child` INT UNSIGNED NULL DEFAULT NULL;

-- Log tables
ALTER TABLE `atcommandlog` MODIFY `atcommand_date` TIMESTAMP NULL;
ALTER TABLE `branchlog` MODIFY `branch_date` TIMESTAMP NULL;
ALTER TABLE `chatlog` MODIFY `time` TIMESTAMP NULL;
ALTER TABLE `loginlog` MODIFY `time` TIMESTAMP NULL;
ALTER TABLE `mvplog` MODIFY `mvp_date` TIMESTAMP NULL;
ALTER TABLE `npclog` MODIFY `npc_date` TIMESTAMP NULL;
ALTER TABLE `picklog` MODIFY `time` TIMESTAMP NULL;
ALTER TABLE `zenylog` MODIFY `time` TIMESTAMP NULL;

INSERT INTO `sql_updates` (`timestamp`) VALUES (1725211254);
Loading