dropped obsolete old map-data tables

This commit is contained in:
following
2013-08-16 13:56:05 +02:00
parent 52e064ee84
commit 990de8e21e
4 changed files with 6 additions and 23 deletions

View File

@@ -351,6 +351,12 @@
sql("ALTER TABLE `user` MODIFY COLUMN `admin` smallint(5) unsigned NOT NULL default '0'");
}
function dbv_120() // remove obsolete tables of very old, discarded map code
{
if (sql_table_exists('mapresult')) sql("DROP TABLE `mapresult`");
if (sql_table_exists('mapresult_data')) sql("DROP TABLE `mapresult_data`");
}
// When adding new mutations, take care that they behave well if run multiple
// times. This improves robustness of database versioning.

View File

@@ -1,8 +0,0 @@
SET NAMES 'utf8';
DROP TABLE IF EXISTS `mapresult`;
CREATE TABLE `mapresult` (
`query_id` int(10) unsigned NOT NULL,
`date_created` datetime NOT NULL,
PRIMARY KEY (`query_id`),
KEY `date_created` (`date_created`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

View File

@@ -1,7 +0,0 @@
SET NAMES 'utf8';
DROP TABLE IF EXISTS `mapresult_data`;
CREATE TABLE `mapresult_data` (
`query_id` int(10) unsigned NOT NULL,
`cache_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`query_id`,`cache_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;

View File

@@ -36,20 +36,12 @@ class slave_cleanup
else
sql_connect_slave($slaveId);
$this->cleanup_mapresult($slaveId);
$this->cleanup_mapresult2($slaveId);
// disconnect slave
sql_disconnect_slave();
}
function cleanup_mapresult($slaveId)
{
// table mapresult
sql_slave("DELETE FROM `mapresult` WHERE `date_created`<DATE_SUB(NOW(), INTERVAL 5 MINUTE)");
sql_slave("DELETE `mapresult_data` FROM `mapresult_data` LEFT JOIN `mapresult` ON `mapresult_data`.`query_id`=`mapresult`.`query_id` WHERE ISNULL(`mapresult`.`query_id`)");
}
function cleanup_mapresult2($slaveId)
{
global $opt;