From 6a84cbb2d527a0fb263a9104690bcfcb24f182e1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 8 Jul 2016 02:59:20 +0300 Subject: Add sql upgrade scripts for convert date/datetime default values. --- sql-files/main.sql | 2 ++ sql-files/upgrades/2016-07-08--02-42.sql | 35 +++++++++++++++++++++++++++++ sql-files/upgrades/2016-07-08--02-51.sql | 30 +++++++++++++++++++++++++ sql-files/upgrades/eAthena-logs-upgrade.sql | 9 ++++++++ sql-files/upgrades/eAthena-main-upgrade.sql | 14 ++++++++++++ sql-files/upgrades/index.txt | 2 ++ sql-files/upgrades/rAthena-logs-upgrade.sql | 8 +++++++ sql-files/upgrades/rAthena-main-upgrade.sql | 13 +++++++++++ 8 files changed, 113 insertions(+) create mode 100644 sql-files/upgrades/2016-07-08--02-42.sql create mode 100644 sql-files/upgrades/2016-07-08--02-51.sql diff --git a/sql-files/main.sql b/sql-files/main.sql index 8466c3a14..fe25fb100 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -825,6 +825,8 @@ INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1440688342); -- 2015-08-2 INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1450241859); -- 2015-12-16--12-57.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1450367880); -- 2015-12-17--15-58.sql INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1457638175); -- 2016-03-10--22-18.sql +INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1467934919); -- 2016-07-08--02-42.sql +INSERT IGNORE INTO `sql_updates` (`timestamp`) VALUES (1467935469); -- 2016-07-08--02-51.sql -- -- Table structure for table `storage` diff --git a/sql-files/upgrades/2016-07-08--02-42.sql b/sql-files/upgrades/2016-07-08--02-42.sql new file mode 100644 index 000000000..94ca7e6db --- /dev/null +++ b/sql-files/upgrades/2016-07-08--02-42.sql @@ -0,0 +1,35 @@ +#1467934919 + +-- This file is part of Hercules. +-- http://herc.ws - http://github.com/HerculesWS/Hercules +-- +-- Copyright (C) 2015-2016 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 . + +ALTER TABLE `charlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `interlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `ipbanlist` MODIFY `btime` DATETIME NULL; +ALTER TABLE `ipbanlist` MODIFY `rtime` DATETIME NULL; +ALTER TABLE `login` MODIFY `lastlogin` DATETIME NULL; +ALTER TABLE `login` MODIFY `birthdate` DATE NULL; + +UPDATE `charlog` SET `time` = NULL WHERE `time` = '0000-00-00 00:00:00'; +UPDATE `interlog` SET `time` = NULL WHERE `time` = '0000-00-00 00:00:00'; +UPDATE `ipbanlist` SET `btime` = NULL WHERE `btime` = '0000-00-00 00:00:00'; +UPDATE `ipbanlist` SET `rtime` = NULL WHERE `rtime` = '0000-00-00 00:00:00'; +UPDATE `login` SET `lastlogin` = NULL WHERE `lastlogin` = '0000-00-00 00:00:00'; +UPDATE `login` SET `birthdate` = NULL WHERE `birthdate` = '0000-00-00'; + +INSERT INTO `sql_updates` (`timestamp`) VALUES (1467934919) diff --git a/sql-files/upgrades/2016-07-08--02-51.sql b/sql-files/upgrades/2016-07-08--02-51.sql new file mode 100644 index 000000000..8ecf1a25f --- /dev/null +++ b/sql-files/upgrades/2016-07-08--02-51.sql @@ -0,0 +1,30 @@ +#1467935469 + +-- This file is part of Hercules. +-- http://herc.ws - http://github.com/HerculesWS/Hercules +-- +-- Copyright (C) 2015-2016 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 . + +ALTER TABLE `atcommandlog` MODIFY `atcommand_date` DATETIME NULL; +ALTER TABLE `branchlog` MODIFY `branch_date` DATETIME NULL; +ALTER TABLE `chatlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `loginlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `mvplog` MODIFY `mvp_date` DATETIME NULL; +ALTER TABLE `npclog` MODIFY `npc_date` DATETIME NULL; +ALTER TABLE `picklog` MODIFY `time` DATETIME NULL; +ALTER TABLE `zenylog` MODIFY `time` DATETIME NULL; + +INSERT INTO `sql_updates` (`timestamp`) VALUES (1467935469) diff --git a/sql-files/upgrades/eAthena-logs-upgrade.sql b/sql-files/upgrades/eAthena-logs-upgrade.sql index 09ed4d8d0..014f119e3 100644 --- a/sql-files/upgrades/eAthena-logs-upgrade.sql +++ b/sql-files/upgrades/eAthena-logs-upgrade.sql @@ -42,3 +42,12 @@ ALTER TABLE `zenylog` MODIFY `type` ENUM('M','T','V','S','N','A','E','B','I','D' -- Add 'P' and 'C' types in `zenylog` ALTER TABLE `zenylog` MODIFY `type` ENUM('T','V','P','M','S','N','D','C','A','E','I','B') NOT NULL DEFAULT 'S'; + +ALTER TABLE `atcommandlog` MODIFY `atcommand_date` DATETIME NULL; +ALTER TABLE `branchlog` MODIFY `branch_date` DATETIME NULL; +ALTER TABLE `chatlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `loginlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `mvplog` MODIFY `mvp_date` DATETIME NULL; +ALTER TABLE `npclog` MODIFY `npc_date` DATETIME NULL; +ALTER TABLE `picklog` MODIFY `time` DATETIME NULL; +ALTER TABLE `zenylog` MODIFY `time` DATETIME NULL; diff --git a/sql-files/upgrades/eAthena-main-upgrade.sql b/sql-files/upgrades/eAthena-main-upgrade.sql index 64b22bfe9..647c9e004 100644 --- a/sql-files/upgrades/eAthena-main-upgrade.sql +++ b/sql-files/upgrades/eAthena-main-upgrade.sql @@ -111,3 +111,17 @@ ALTER TABLE `inventory` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAUL ALTER TABLE `mail` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; ALTER TABLE `storage` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0'; + +ALTER TABLE `charlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `interlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `ipbanlist` MODIFY `btime` DATETIME NULL; +ALTER TABLE `ipbanlist` MODIFY `rtime` DATETIME NULL; +ALTER TABLE `login` MODIFY `lastlogin` DATETIME NULL; +ALTER TABLE `login` MODIFY `birthdate` DATE NULL; + +UPDATE `charlog` SET `time` = NULL WHERE `time` = '0000-00-00 00:00:00'; +UPDATE `interlog` SET `time` = NULL WHERE `time` = '0000-00-00 00:00:00'; +UPDATE `ipbanlist` SET `btime` = NULL WHERE `btime` = '0000-00-00 00:00:00'; +UPDATE `ipbanlist` SET `rtime` = NULL WHERE `rtime` = '0000-00-00 00:00:00'; +UPDATE `login` SET `lastlogin` = NULL WHERE `lastlogin` = '0000-00-00 00:00:00'; +UPDATE `login` SET `birthdate` = NULL WHERE `birthdate` = '0000-00-00'; diff --git a/sql-files/upgrades/index.txt b/sql-files/upgrades/index.txt index 6e81bd199..b0347ab72 100644 --- a/sql-files/upgrades/index.txt +++ b/sql-files/upgrades/index.txt @@ -30,3 +30,5 @@ 2015-08-27--20-42.sql 2015-12-17--15-58.sql 2016-03-10--22-18.sql +2016-07-08--02-42.sql +2016-07-08--02-51.sql diff --git a/sql-files/upgrades/rAthena-logs-upgrade.sql b/sql-files/upgrades/rAthena-logs-upgrade.sql index 5e9dbf60c..09a571818 100644 --- a/sql-files/upgrades/rAthena-logs-upgrade.sql +++ b/sql-files/upgrades/rAthena-logs-upgrade.sql @@ -40,3 +40,11 @@ ALTER TABLE `picklog` MODIFY `card0` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `picklog` MODIFY `card1` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `picklog` MODIFY `card2` INT(11) NOT NULL DEFAULT '0'; ALTER TABLE `picklog` MODIFY `card3` INT(11) NOT NULL DEFAULT '0'; +ALTER TABLE `atcommandlog` MODIFY `atcommand_date` DATETIME NULL; +ALTER TABLE `branchlog` MODIFY `branch_date` DATETIME NULL; +ALTER TABLE `chatlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `loginlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `mvplog` MODIFY `mvp_date` DATETIME NULL; +ALTER TABLE `npclog` MODIFY `npc_date` DATETIME NULL; +ALTER TABLE `picklog` MODIFY `time` DATETIME NULL; +ALTER TABLE `zenylog` MODIFY `time` DATETIME NULL; diff --git a/sql-files/upgrades/rAthena-main-upgrade.sql b/sql-files/upgrades/rAthena-main-upgrade.sql index e214e8d34..5dd6111a5 100644 --- a/sql-files/upgrades/rAthena-main-upgrade.sql +++ b/sql-files/upgrades/rAthena-main-upgrade.sql @@ -337,3 +337,16 @@ INSERT INTO `global_acc_reg_str_db` (`account_id`, `key`, `index`, `value`) SELE -- Dropping now useless table DROP TABLE `global_reg_value`; +ALTER TABLE `charlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `interlog` MODIFY `time` DATETIME NULL; +ALTER TABLE `ipbanlist` MODIFY `btime` DATETIME NULL; +ALTER TABLE `ipbanlist` MODIFY `rtime` DATETIME NULL; +ALTER TABLE `login` MODIFY `lastlogin` DATETIME NULL; +ALTER TABLE `login` MODIFY `birthdate` DATE NULL; + +UPDATE `charlog` SET `time` = NULL WHERE `time` = '0000-00-00 00:00:00'; +UPDATE `interlog` SET `time` = NULL WHERE `time` = '0000-00-00 00:00:00'; +UPDATE `ipbanlist` SET `btime` = NULL WHERE `btime` = '0000-00-00 00:00:00'; +UPDATE `ipbanlist` SET `rtime` = NULL WHERE `rtime` = '0000-00-00 00:00:00'; +UPDATE `login` SET `lastlogin` = NULL WHERE `lastlogin` = '0000-00-00 00:00:00'; +UPDATE `login` SET `birthdate` = NULL WHERE `birthdate` = '0000-00-00'; -- cgit v1.2.3-60-g2f50