diff --git a/bin/dbsv-update.php b/bin/dbsv-update.php index 60e28c2d..184a14e0 100644 --- a/bin/dbsv-update.php +++ b/bin/dbsv-update.php @@ -40,7 +40,18 @@ } while ($db_version > 0); - // test if a certain database field exists + // test if a database table exists + function table_exists($table) + { + global $opt; + + return sql_value("SELECT COUNT(*) + FROM `information_schema`.`tables` + WHERE `table_schema`='&1' AND `table_name`='&2'", + 0, $opt['db']['placeholder']['db'], $table) > 0; + } + + // test if a database field exists function field_exists($table, $field) { global $opt; @@ -113,4 +124,24 @@ sql("CALL sp_refreshall_statpic()"); } + function dbv_103() // update comments on static tables + { + if (table_exists('geodb_areas')) sql("ALTER TABLE `geodb_areas` COMMENT = 'not in use'"); + if (table_exists('geodb_changelog')) sql("ALTER TABLE `geodb_changelog` COMMENT = 'not in use'"); + if (table_exists('geodb_coordinates')) sql("ALTER TABLE `geodb_coordinates` COMMENT = 'static content'"); + if (table_exists('geodb_floatdata')) sql("ALTER TABLE `geodb_floatdata` COMMENT = 'not in use'"); + if (table_exists('geodb_hierarchies')) sql("ALTER TABLE `geodb_hierarchies` COMMENT = 'static content'"); + if (table_exists('geodb_intdata')) sql("ALTER TABLE `geodb_intdata` COMMENT = 'not in use'"); + if (table_exists('geodb_locations')) sql("ALTER TABLE `geodb_locations` COMMENT = 'static content'"); + if (table_exists('geodb_polygons')) sql("ALTER TABLE `geodb_polygons` COMMENT = 'not in use'"); + if (table_exists('geodb_search')) sql("ALTER TABLE `geodb_search` COMMENT = 'static content, not in use'"); + if (table_exists('geodb_textdata')) sql("ALTER TABLE `geodb_textdata` COMMENT = 'static content'"); + if (table_exists('geodb_type_names')) sql("ALTER TABLE `geodb_type_names` COMMENT = 'not in use'"); + if (table_exists('pw_dict')) sql("ALTER TABLE `pw_dict` COMMENT = 'static content'"); + sql("ALTER TABLE `npa_areas` COMMENT = 'static content'"); + sql("ALTER TABLE `npa_types` COMMENT = 'static content'"); + sql("ALTER TABLE `nuts_codes` COMMENT = 'static content'"); + sql("ALTER TABLE `nuts_layer` COMMENT = 'static content'"); + } + ?> \ No newline at end of file diff --git a/htdocs/doc/sql/static-data/static-data.txt b/htdocs/doc/sql/static-data/static-data.txt index f0e76a22..6ec0d3d0 100644 --- a/htdocs/doc/sql/static-data/static-data.txt +++ b/htdocs/doc/sql/static-data/static-data.txt @@ -32,6 +32,7 @@ License: GNU Free Documentation License There are more geodb_ tables present in OC developer and production systems, which are undocumented, mostly empty and not in use anywhere. Probably some unfinished experiment. +(see bin/dbsv-update.php, mutation #103) Tables: gns_locations