Moved table uptime from world database to character database.

Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
invliD 2009-03-26 16:23:57 +01:00 committed by Triply
parent 4f17a6a4e2
commit 68ec6ae8ab
7 changed files with 49 additions and 28 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_7324_02_characters_character_aura` bit(1) default NULL `required_7544_02_characters_uptime` 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';
-- --
@ -1321,6 +1321,28 @@ LOCK TABLES `saved_variables` WRITE;
/*!40000 ALTER TABLE `saved_variables` DISABLE KEYS */; /*!40000 ALTER TABLE `saved_variables` DISABLE KEYS */;
/*!40000 ALTER TABLE `saved_variables` ENABLE KEYS */; /*!40000 ALTER TABLE `saved_variables` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `uptime`
--
DROP TABLE IF EXISTS `uptime`;
CREATE TABLE `uptime` (
`starttime` bigint(20) unsigned NOT NULL default '0',
`startstring` varchar(64) NOT NULL default '',
`uptime` bigint(20) unsigned NOT NULL default '0',
`maxplayers` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`starttime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';
--
-- Dumping data for table `uptime`
--
LOCK TABLES `uptime` WRITE;
/*!40000 ALTER TABLE `uptime` DISABLE KEYS */;
/*!40000 ALTER TABLE `uptime` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

View file

@ -22,7 +22,7 @@
DROP TABLE IF EXISTS `db_version`; DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` ( CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`required_7536_01_mangos_spell_chain` bit(1) default NULL `required_7544_01_mangos_uptime` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@ -17851,28 +17851,6 @@ LOCK TABLES `transports` WRITE;
/*!40000 ALTER TABLE `transports` DISABLE KEYS */; /*!40000 ALTER TABLE `transports` DISABLE KEYS */;
/*!40000 ALTER TABLE `transports` ENABLE KEYS */; /*!40000 ALTER TABLE `transports` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `uptime`
--
DROP TABLE IF EXISTS `uptime`;
CREATE TABLE `uptime` (
`starttime` bigint(20) unsigned NOT NULL default '0',
`startstring` varchar(64) NOT NULL default '',
`uptime` bigint(20) unsigned NOT NULL default '0',
`maxplayers` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`starttime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';
--
-- Dumping data for table `uptime`
--
LOCK TABLES `uptime` WRITE;
/*!40000 ALTER TABLE `uptime` DISABLE KEYS */;
/*!40000 ALTER TABLE `uptime` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

View file

@ -0,0 +1,3 @@
ALTER TABLE db_version CHANGE COLUMN required_7536_01_mangos_spell_chain required_7544_01_mangos_uptime bit;
DROP TABLE IF EXISTS `uptime`;

View file

@ -0,0 +1,14 @@
ALTER TABLE character_db_version CHANGE COLUMN required_7324_02_characters_character_aura required_7544_02_characters_uptime bit;
--
-- Table structure for table `uptime`
--
DROP TABLE IF EXISTS `uptime`;
CREATE TABLE `uptime` (
`starttime` bigint(20) unsigned NOT NULL default '0',
`startstring` varchar(64) NOT NULL default '',
`uptime` bigint(20) unsigned NOT NULL default '0',
`maxplayers` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`starttime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';

View file

@ -202,6 +202,8 @@ pkgdata_DATA = \
7495_01_mangos_mangos_string.sql \ 7495_01_mangos_mangos_string.sql \
7503_01_mangos_command.sql \ 7503_01_mangos_command.sql \
7536_01_mangos_spell_chain.sql \ 7536_01_mangos_spell_chain.sql \
7544_01_mangos_uptime.sql \
7544_02_characters_uptime.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -384,4 +386,6 @@ EXTRA_DIST = \
7495_01_mangos_mangos_string.sql \ 7495_01_mangos_mangos_string.sql \
7503_01_mangos_command.sql \ 7503_01_mangos_command.sql \
7536_01_mangos_spell_chain.sql \ 7536_01_mangos_spell_chain.sql \
7544_01_mangos_uptime.sql \
7544_02_characters_uptime.sql \
README README

View file

@ -1365,7 +1365,7 @@ void World::SetInitialWorldSettings()
sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d", sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d",
local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec);
WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', " I64FMTD ", 0)", loginDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', " I64FMTD ", 0)",
isoDate, uint64(m_startTime)); isoDate, uint64(m_startTime));
m_timers[WUPDATE_OBJECTS].SetInterval(0); m_timers[WUPDATE_OBJECTS].SetInterval(0);
@ -1532,10 +1532,10 @@ void World::Update(uint32 diff)
if (m_timers[WUPDATE_UPTIME].Passed()) if (m_timers[WUPDATE_UPTIME].Passed())
{ {
uint32 tmpDiff = (m_gameTime - m_startTime); uint32 tmpDiff = (m_gameTime - m_startTime);
uint32 maxClientsNum = sWorld.GetMaxActiveSessionCount(); uint32 maxClientsNum = GetMaxActiveSessionCount();
m_timers[WUPDATE_UPTIME].Reset(); m_timers[WUPDATE_UPTIME].Reset();
WorldDatabase.PExecute("UPDATE uptime SET uptime = %d, maxplayers = %d WHERE starttime = " I64FMTD, tmpDiff, maxClientsNum, uint64(m_startTime)); loginDatabase.PExecute("UPDATE uptime SET uptime = %d, maxplayers = %d WHERE starttime = " I64FMTD, tmpDiff, maxClientsNum, uint64(m_startTime));
} }
/// <li> Handle all other objects /// <li> Handle all other objects

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 "7543" #define REVISION_NR "7544"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__