[11716] Always use _unsigned_ BIGINT fields in DB for time store

Also some other BIGINT fields fixed.
This commit is contained in:
VladimirMangos 2011-07-07 04:20:34 +04:00
parent f4be64ff48
commit b5e136c289
15 changed files with 75 additions and 25 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_11704_01_characters_auction` bit(1) default NULL `required_11716_10_characters_mail` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --
@ -148,8 +148,8 @@ CREATE TABLE `auction` (
`item_randompropertyid` int(11) NOT NULL default '0', `item_randompropertyid` int(11) NOT NULL default '0',
`itemowner` int(11) unsigned NOT NULL default '0', `itemowner` int(11) unsigned NOT NULL default '0',
`buyoutprice` int(11) NOT NULL default '0', `buyoutprice` int(11) NOT NULL default '0',
`time` bigint(40) NOT NULL default '0', `time` bigint(40) unsigned NOT NULL default '0',
`moneyTime` bigint(40) NOT NULL default '0', `moneyTime` bigint(40) unsigned NOT NULL default '0',
`buyguid` int(11) unsigned NOT NULL default '0', `buyguid` int(11) unsigned NOT NULL default '0',
`lastbid` int(11) NOT NULL default '0', `lastbid` int(11) NOT NULL default '0',
`startbid` int(11) NOT NULL default '0', `startbid` int(11) NOT NULL default '0',
@ -260,7 +260,7 @@ CREATE TABLE `characters` (
`actionBars` tinyint(3) UNSIGNED NOT NULL default '0', `actionBars` tinyint(3) UNSIGNED NOT NULL default '0',
`deleteInfos_Account` int(11) UNSIGNED default NULL, `deleteInfos_Account` int(11) UNSIGNED default NULL,
`deleteInfos_Name` varchar(12) default NULL, `deleteInfos_Name` varchar(12) default NULL,
`deleteDate` bigint(20) default NULL, `deleteDate` bigint(20) unsigned default NULL,
PRIMARY KEY (`guid`), PRIMARY KEY (`guid`),
KEY `idx_account` (`account`), KEY `idx_account` (`account`),
KEY `idx_online` (`online`), KEY `idx_online` (`online`),
@ -457,7 +457,7 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `character_equipmentsets`; DROP TABLE IF EXISTS `character_equipmentsets`;
CREATE TABLE `character_equipmentsets` ( CREATE TABLE `character_equipmentsets` (
`guid` int(11) NOT NULL default '0', `guid` int(11) NOT NULL default '0',
`setguid` bigint(20) NOT NULL auto_increment, `setguid` bigint(20) unsigned NOT NULL auto_increment,
`setindex` tinyint(4) NOT NULL default '0', `setindex` tinyint(4) NOT NULL default '0',
`name` varchar(100) NOT NULL, `name` varchar(100) NOT NULL,
`iconname` varchar(100) NOT NULL, `iconname` varchar(100) NOT NULL,
@ -1049,7 +1049,7 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `creature_respawn`; DROP TABLE IF EXISTS `creature_respawn`;
CREATE TABLE `creature_respawn` ( CREATE TABLE `creature_respawn` (
`guid` int(10) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', `guid` int(10) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`respawntime` bigint(20) NOT NULL default '0', `respawntime` bigint(20) unsigned NOT NULL default '0',
`instance` mediumint(8) unsigned NOT NULL default '0', `instance` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`instance`), PRIMARY KEY (`guid`,`instance`),
KEY `instance` (`instance`) KEY `instance` (`instance`)
@ -1090,7 +1090,7 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `gameobject_respawn`; DROP TABLE IF EXISTS `gameobject_respawn`;
CREATE TABLE `gameobject_respawn` ( CREATE TABLE `gameobject_respawn` (
`guid` int(10) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier', `guid` int(10) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`respawntime` bigint(20) NOT NULL default '0', `respawntime` bigint(20) unsigned NOT NULL default '0',
`instance` mediumint(8) unsigned NOT NULL default '0', `instance` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`instance`), PRIMARY KEY (`guid`,`instance`),
KEY `instance` (`instance`) KEY `instance` (`instance`)
@ -1202,8 +1202,8 @@ CREATE TABLE `guild` (
`BackgroundColor` int(5) NOT NULL default '0', `BackgroundColor` int(5) NOT NULL default '0',
`info` text NOT NULL, `info` text NOT NULL,
`motd` varchar(255) NOT NULL default '', `motd` varchar(255) NOT NULL default '',
`createdate` bigint(20) NOT NULL default '0', `createdate` bigint(20) unsigned NOT NULL default '0',
`BankMoney` bigint(20) NOT NULL default '0', `BankMoney` bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (`guildid`) PRIMARY KEY (`guildid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Guild System'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Guild System';
@ -1325,13 +1325,13 @@ UNLOCK TABLES;
DROP TABLE IF EXISTS `guild_eventlog`; DROP TABLE IF EXISTS `guild_eventlog`;
CREATE TABLE `guild_eventlog` ( CREATE TABLE `guild_eventlog` (
`guildid` int(11) NOT NULL COMMENT 'Guild Identificator', `guildid` int(11) unsigned NOT NULL COMMENT 'Guild Identificator',
`LogGuid` int(11) NOT NULL COMMENT 'Log record identificator - auxiliary column', `LogGuid` int(11) unsigned NOT NULL COMMENT 'Log record identificator - auxiliary column',
`EventType` tinyint(1) NOT NULL COMMENT 'Event type', `EventType` tinyint(1) unsigned NOT NULL COMMENT 'Event type',
`PlayerGuid1` int(11) NOT NULL COMMENT 'Player 1', `PlayerGuid1` int(11) unsigned NOT NULL COMMENT 'Player 1',
`PlayerGuid2` int(11) NOT NULL COMMENT 'Player 2', `PlayerGuid2` int(11) unsigned NOT NULL COMMENT 'Player 2',
`NewRank` tinyint(2) NOT NULL COMMENT 'New rank(in case promotion/demotion)', `NewRank` tinyint(2) unsigned NOT NULL COMMENT 'New rank(in case promotion/demotion)',
`TimeStamp` bigint(20) NOT NULL COMMENT 'Event UNIX time', `TimeStamp` bigint(20) unsigned NOT NULL COMMENT 'Event UNIX time',
PRIMARY KEY (`guildid`, `LogGuid`), PRIMARY KEY (`guildid`, `LogGuid`),
INDEX `Idx_PlayerGuid1`(`PlayerGuid1`), INDEX `Idx_PlayerGuid1`(`PlayerGuid1`),
INDEX `Idx_PlayerGuid2`(`PlayerGuid2`), INDEX `Idx_PlayerGuid2`(`PlayerGuid2`),
@ -1418,7 +1418,7 @@ DROP TABLE IF EXISTS `instance`;
CREATE TABLE `instance` ( CREATE TABLE `instance` (
`id` int(11) unsigned NOT NULL default '0', `id` int(11) unsigned NOT NULL default '0',
`map` int(11) unsigned NOT NULL default '0', `map` int(11) unsigned NOT NULL default '0',
`resettime` bigint(40) NOT NULL default '0', `resettime` bigint(40) unsigned NOT NULL default '0',
`difficulty` tinyint(1) unsigned NOT NULL default '0', `difficulty` tinyint(1) unsigned NOT NULL default '0',
`data` longtext, `data` longtext,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
@ -1442,7 +1442,7 @@ DROP TABLE IF EXISTS `instance_reset`;
CREATE TABLE `instance_reset` ( CREATE TABLE `instance_reset` (
`mapid` int(11) unsigned NOT NULL default '0', `mapid` int(11) unsigned NOT NULL default '0',
`difficulty` tinyint(1) unsigned NOT NULL default '0', `difficulty` tinyint(1) unsigned NOT NULL default '0',
`resettime` bigint(40) NOT NULL default '0', `resettime` bigint(40) unsigned NOT NULL default '0',
PRIMARY KEY (`mapid`,`difficulty`) PRIMARY KEY (`mapid`,`difficulty`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -1518,8 +1518,8 @@ CREATE TABLE `mail` (
`subject` longtext, `subject` longtext,
`body` longtext, `body` longtext,
`has_items` tinyint(3) unsigned NOT NULL default '0', `has_items` tinyint(3) unsigned NOT NULL default '0',
`expire_time` bigint(40) NOT NULL default '0', `expire_time` bigint(40) unsigned NOT NULL default '0',
`deliver_time` bigint(40) NOT NULL default '0', `deliver_time` bigint(40) unsigned NOT NULL default '0',
`money` int(11) unsigned NOT NULL default '0', `money` int(11) unsigned NOT NULL default '0',
`cod` int(11) unsigned NOT NULL default '0', `cod` int(11) unsigned NOT NULL default '0',
`checked` tinyint(3) unsigned NOT NULL default '0', `checked` tinyint(3) unsigned NOT NULL default '0',

View file

@ -0,0 +1,5 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11704_01_characters_auction required_11716_01_characters_auction bit;
ALTER TABLE `auction`
CHANGE COLUMN `time` `time` bigint(40) unsigned NOT NULL default '0',
CHANGE COLUMN `moneyTime` `moneyTime` bigint(40) unsigned NOT NULL default '0';

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_01_characters_auction required_11716_02_characters_characters bit;
ALTER TABLE `characters`
CHANGE COLUMN `deleteDate` `deleteDate` bigint(20) unsigned default NULL;

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_02_characters_characters required_11716_03_characters_character_equipmentsets bit;
ALTER TABLE `character_equipmentsets`
CHANGE COLUMN `setguid` `setguid` bigint(20) unsigned NOT NULL auto_increment;

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_03_characters_character_equipmentsets required_11716_04_characters_creature_respawn bit;
ALTER TABLE `creature_respawn`
CHANGE COLUMN `respawntime` `respawntime` bigint(20) unsigned NOT NULL default '0';

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_04_characters_creature_respawn required_11716_05_characters_gameobject_respawn bit;
ALTER TABLE `gameobject_respawn`
CHANGE COLUMN `respawntime` `respawntime` bigint(20) unsigned NOT NULL default '0';

View file

@ -0,0 +1,5 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_05_characters_gameobject_respawn required_11716_06_characters_guild bit;
ALTER TABLE `guild`
CHANGE COLUMN `createdate` `createdate` bigint(20) unsigned NOT NULL default '0',
CHANGE COLUMN `BankMoney` `BankMoney` bigint(20) unsigned NOT NULL default '0';

View file

@ -0,0 +1,10 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_06_characters_guild required_11716_07_characters_guild_eventlog bit;
ALTER TABLE `guild_eventlog`
CHANGE COLUMN `guildid` `guildid` int(11) unsigned NOT NULL COMMENT 'Guild Identificator',
CHANGE COLUMN `LogGuid` `LogGuid` int(11) unsigned NOT NULL COMMENT 'Log record identificator - auxiliary column',
CHANGE COLUMN `EventType` `EventType` tinyint(1) unsigned NOT NULL COMMENT 'Event type',
CHANGE COLUMN `PlayerGuid1` `PlayerGuid1` int(11) unsigned NOT NULL COMMENT 'Player 1',
CHANGE COLUMN `PlayerGuid2` `PlayerGuid2` int(11) unsigned NOT NULL COMMENT 'Player 2',
CHANGE COLUMN `NewRank` `NewRank` tinyint(2) unsigned NOT NULL COMMENT 'New rank(in case promotion/demotion)',
CHANGE COLUMN `TimeStamp` `TimeStamp` bigint(20) unsigned NOT NULL COMMENT 'Event UNIX time';

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_07_characters_guild_eventlog required_11716_08_characters_instance bit;
ALTER TABLE `instance`
CHANGE COLUMN `resettime` `resettime` bigint(40) unsigned NOT NULL default '0';

View file

@ -0,0 +1,4 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_08_characters_instance required_11716_09_characters_instance_reset bit;
ALTER TABLE `instance_reset`
CHANGE COLUMN `resettime` `resettime` bigint(40) unsigned NOT NULL default '0';

View file

@ -0,0 +1,6 @@
ALTER TABLE character_db_version CHANGE COLUMN required_11716_09_characters_instance_reset required_11716_10_characters_mail bit;
ALTER TABLE `mail`
CHANGE COLUMN `expire_time` `expire_time` bigint(40) unsigned NOT NULL default '0',
CHANGE COLUMN `deliver_time` `deliver_time` bigint(40) unsigned NOT NULL default '0';

View file

@ -386,8 +386,8 @@ void AuctionHouseMgr::LoadAuctions()
} }
auction->buyout = fields[7].GetUInt32(); auction->buyout = fields[7].GetUInt32();
auction->expireTime = fields[8].GetUInt32(); auction->expireTime = time_t(fields[8].GetUInt64());
auction->moneyDeliveryTime = fields[9].GetUInt32(); auction->moneyDeliveryTime = time_t(fields[9].GetUInt64());
auction->bidder = fields[10].GetUInt32(); auction->bidder = fields[10].GetUInt32();
auction->bid = fields[11].GetUInt32(); auction->bid = fields[11].GetUInt32();
auction->startbid = fields[12].GetUInt32(); auction->startbid = fields[12].GetUInt32();

View file

@ -277,7 +277,7 @@ bool Guild::LoadGuildFromDB(QueryResult *guildDataResult)
m_BackgroundColor = fields[7].GetUInt32(); m_BackgroundColor = fields[7].GetUInt32();
GINFO = fields[8].GetCppString(); GINFO = fields[8].GetCppString();
MOTD = fields[9].GetCppString(); MOTD = fields[9].GetCppString();
m_CreatedDate = fields[10].GetUInt64(); m_CreatedDate = time_t(fields[10].GetUInt64());
m_GuildBankMoney = fields[11].GetUInt64(); m_GuildBankMoney = fields[11].GetUInt64();
uint32 purchasedTabs = fields[12].GetUInt32(); uint32 purchasedTabs = fields[12].GetUInt32();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11715" #define REVISION_NR "11716"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_11704_01_characters_auction" #define REVISION_DB_CHARACTERS "required_11716_10_characters_mail"
#define REVISION_DB_MANGOS "required_11701_01_mangos_command" #define REVISION_DB_MANGOS "required_11701_01_mangos_command"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version" #define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__