[7546] Revert [7544] correcty move uptime table to Realm database, use realmid column.

Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
Triply 2009-03-26 17:56:42 +01:00
parent ff0c31e103
commit b09df0aade
7 changed files with 52 additions and 28 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` (
`required_7544_02_characters_uptime` bit(1) default NULL
`required_7546_01_characters_uptime` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
--
@ -1321,28 +1321,6 @@ LOCK TABLES `saved_variables` WRITE;
/*!40000 ALTER TABLE `saved_variables` DISABLE KEYS */;
/*!40000 ALTER TABLE `saved_variables` ENABLE KEYS */;
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 */;

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `realmd_db_version`;
CREATE TABLE `realmd_db_version` (
`required_6976_01_realmd_realmd_db_version` bit(1) default NULL
`required_7546_02_realmd_uptime` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
--
@ -174,6 +174,29 @@ INSERT INTO `realmlist` VALUES
(1,'MaNGOS','127.0.0.1',8085,1,0,1,0,0);
/*!40000 ALTER TABLE `realmlist` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `uptime`
--
DROP TABLE IF EXISTS `uptime`;
CREATE TABLE `uptime` (
`realmid` int(11) unsigned NOT NULL,
`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 (`realmid`,`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 */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;

View file

@ -0,0 +1,3 @@
ALTER TABLE character_db_version CHANGE COLUMN required_7544_02_characters_uptime required_7546_01_characters_uptime bit;
DROP TABLE IF EXISTS `uptime`;

View file

@ -0,0 +1,16 @@
ALTER TABLE realmd_db_version CHANGE COLUMN required_6976_01_realmd_realmd_db_version required_7546_02_realmd_uptime bit;
--
-- Table structure for table `uptime`
--
DROP TABLE IF EXISTS `uptime`;
CREATE TABLE `uptime` (
`realmid` int(11) unsigned NOT NULL,
`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 (`realmid`,`starttime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Uptime system';

View file

@ -204,6 +204,8 @@ pkgdata_DATA = \
7536_01_mangos_spell_chain.sql \
7544_01_mangos_uptime.sql \
7544_02_characters_uptime.sql \
7546_01_characters_uptime.sql \
7546_02_realmd_uptime.sql \
README
## Additional files to include when running 'make dist'
@ -388,4 +390,6 @@ EXTRA_DIST = \
7536_01_mangos_spell_chain.sql \
7544_01_mangos_uptime.sql \
7544_02_characters_uptime.sql \
7546_01_characters_uptime.sql \
7546_02_realmd_uptime.sql \
README

View file

@ -1365,8 +1365,8 @@ void World::SetInitialWorldSettings()
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);
loginDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', " I64FMTD ", 0)",
isoDate, uint64(m_startTime));
loginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " I64FMTD ", '%s', 0)",
realmID, uint64(m_startTime), isoDate);
m_timers[WUPDATE_OBJECTS].SetInterval(0);
m_timers[WUPDATE_SESSIONS].SetInterval(0);
@ -1535,7 +1535,7 @@ void World::Update(uint32 diff)
uint32 maxClientsNum = GetMaxActiveSessionCount();
m_timers[WUPDATE_UPTIME].Reset();
loginDatabase.PExecute("UPDATE uptime SET uptime = %d, maxplayers = %d WHERE starttime = " I64FMTD, tmpDiff, maxClientsNum, uint64(m_startTime));
loginDatabase.PExecute("UPDATE uptime SET uptime = %u, maxplayers = %u WHERE realmid = %u AND starttime = " I64FMTD, tmpDiff, maxClientsNum, realmID, uint64(m_startTime));
}
/// <li> Handle all other objects

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7545"
#define REVISION_NR "7546"
#endif // __REVISION_NR_H__