database structure update

This commit is contained in:
following
2013-05-28 16:57:16 +02:00
parent bc3454598d
commit b6f4603c61
3 changed files with 21 additions and 1 deletions

View File

@@ -165,4 +165,12 @@
) ENGINE=MyISAM DEFAULT CHARSET=utf8"); ) ENGINE=MyISAM DEFAULT CHARSET=utf8");
} }
function dbv_107() // sync of table definitions, developer and production system
{
sql("ALTER TABLE `caches` MODIFY `meta_last_modified` datetime NOT NULL COMMENT 'via Trigger (stat_caches, gk_item_waypoint)'");
sql("ALTER TABLE `countries` MODIFY `en` varchar(128) NOT NULL");
if (!sql_index_exists('cache_reports', 'userid'))
sql("ALTER TABLE `cache_reports` ADD INDEX `userid` (`userid`)");
}
?> ?>

View File

@@ -12,5 +12,6 @@ CREATE TABLE `cache_reports` (
`lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `lastmodified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `status` (`status`,`adminid`), KEY `status` (`status`,`adminid`),
KEY `status_2` (`adminid`,`status`) KEY `status_2` (`adminid`,`status`),
KEY `userid` (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='submitted reports on caches' ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='submitted reports on caches' ;

View File

@@ -1120,4 +1120,15 @@
'', $opt['db']['placeholder']['db'], $table, $field) ); '', $opt['db']['placeholder']['db'], $table, $field) );
} }
// test if a database index exists
function sql_index_exists($table, $index)
{
global $opt;
return sql_value("SELECT COUNT(*)
FROM `information_schema`.`statistics`
WHERE `table_schema`='&1' AND `table_name`='&2' AND `index_name`='&3'",
0, $opt['db']['placeholder']['db'], $table, $index) > 0;
}
?> ?>