From 4dd5ef4045a9d90421c5ba7baab3e7ac547db2e7 Mon Sep 17 00:00:00 2001 From: Bertil Chapuis Date: Mon, 6 Jan 2025 14:00:17 +0100 Subject: [PATCH] Remove refresh scripts and fix tests --- .../metadata/PostgresMetadataTest.java | 8 ++--- .../queries/osm_create_gin_indexes.sql | 8 ++--- .../queries/osm_create_gist_indexes.sql | 12 +++---- .../queries/osm_create_spgist_indexes.sql | 12 +++---- .../resources/queries/osm_create_tables.sql | 8 ++--- .../resources/queries/osm_drop_tables.sql | 8 ++--- .../resources/queries/osm_truncate_table.sql | 8 ++--- basemap/layers/linestring/refresh.sql | 31 ------------------- basemap/layers/polygon/refresh.sql | 31 ------------------- basemap/refresh.js | 2 -- 10 files changed, 32 insertions(+), 96 deletions(-) delete mode 100644 basemap/layers/linestring/refresh.sql delete mode 100644 basemap/layers/polygon/refresh.sql diff --git a/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java b/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java index e3edee1f0..ce027a9cb 100644 --- a/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java +++ b/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java @@ -40,10 +40,10 @@ void resetDatabase() throws SQLException, IOException { PostgresUtils.executeResource(connection, "queries/osm_drop_tables.sql"); PostgresUtils.executeResource(connection, "queries/osm_drop_tables.sql"); PostgresUtils.executeResource(connection, "queries/osm_create_tables.sql"); - assertTrue(tableExists("osm_headers")); - assertTrue(tableExists("osm_nodes")); - assertTrue(tableExists("osm_ways")); - assertTrue(tableExists("osm_relations")); + assertTrue(tableExists("osm_header")); + assertTrue(tableExists("osm_node")); + assertTrue(tableExists("osm_way")); + assertTrue(tableExists("osm_relation")); } } diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql b/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql index a055b901d..90683ad70 100644 --- a/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql +++ b/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql @@ -13,11 +13,11 @@ -- See the License for the specific language governing permissions and -- limitations under the License. CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gin ON - osm_ways + INDEX IF NOT EXISTS osm_way_gin ON + osm_way USING gin(nodes); CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gin ON - osm_relations + INDEX IF NOT EXISTS osm_relation_gin ON + osm_relation USING gin(member_refs); diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql b/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql index 198c858ec..d279c6725 100644 --- a/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql +++ b/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql @@ -13,16 +13,16 @@ -- See the License for the specific language governing permissions and -- limitations under the License. CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_nodes_gix ON - osm_nodes + INDEX IF NOT EXISTS osm_nodes_gix ON + osm_node USING GIST(geom); CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gix ON - osm_ways + INDEX IF NOT EXISTS osm_ways_gix ON + osm_way USING GIST(geom); CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gix ON - osm_relations + INDEX IF NOT EXISTS osm_relations_gix ON + osm_relation USING GIST(geom); \ No newline at end of file diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql b/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql index c64375734..0d03af7e3 100644 --- a/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql +++ b/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql @@ -13,16 +13,16 @@ -- See the License for the specific language governing permissions and -- limitations under the License. CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_nodes_gix ON - osm_nodes + INDEX IF NOT EXISTS osm_node_gix ON + osm_node USING SPGIST(geom); CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gix ON - osm_ways + INDEX IF NOT EXISTS osm_way_gix ON + osm_way USING SPGIST(geom); CREATE - INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gix ON - osm_relations + INDEX IF NOT EXISTS osm_relation_gix ON + osm_relation USING SPGIST(geom); \ No newline at end of file diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql b/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql index dec31a96d..e783afd7f 100644 --- a/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql +++ b/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql @@ -14,7 +14,7 @@ -- limitations under the License. CREATE TABLE - IF NOT EXISTS osm_headers( + IF NOT EXISTS osm_header( replication_sequence_number BIGINT PRIMARY KEY, replication_timestamp TIMESTAMP WITHOUT TIME ZONE, replication_url text, @@ -24,7 +24,7 @@ CREATE CREATE TABLE - osm_nodes( + osm_node( id BIGINT PRIMARY KEY, version INT, uid INT, @@ -38,7 +38,7 @@ CREATE CREATE TABLE - osm_ways( + osm_way( id BIGINT PRIMARY KEY, version INT, uid INT, @@ -51,7 +51,7 @@ CREATE CREATE TABLE - osm_relations( + osm_relation( id BIGINT PRIMARY KEY, version INT, uid INT, diff --git a/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql b/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql index 6a93978f4..c6d84e2ce 100644 --- a/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql +++ b/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql @@ -14,16 +14,16 @@ -- limitations under the License. DROP TABLE - IF EXISTS osm_headers; + IF EXISTS osm_header; DROP TABLE - IF EXISTS osm_nodes; + IF EXISTS osm_node; DROP TABLE - IF EXISTS osm_ways; + IF EXISTS osm_way; DROP TABLE - IF EXISTS osm_relations; \ No newline at end of file + IF EXISTS osm_relation; \ No newline at end of file diff --git a/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql b/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql index 6de2ecbca..d2b29453c 100644 --- a/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql +++ b/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql @@ -14,13 +14,13 @@ -- limitations under the License. TRUNCATE TABLE - osm_headers; + osm_header; TRUNCATE TABLE - osm_nodes; + osm_node; TRUNCATE TABLE - osm_ways; + osm_way; TRUNCATE TABLE - osm_relations; \ No newline at end of file + osm_relation; \ No newline at end of file diff --git a/basemap/layers/linestring/refresh.sql b/basemap/layers/linestring/refresh.sql deleted file mode 100644 index 31b9b8618..000000000 --- a/basemap/layers/linestring/refresh.sql +++ /dev/null @@ -1,31 +0,0 @@ --- Licensed to the Apache Software Foundation (ASF) under one or more --- contributor license agreements. See the NOTICE file distributed with --- this work for additional information regarding copyright ownership. --- The ASF licenses this file to you under the Apache License, Version 2.0 --- (the "License"); you may not use this file except in compliance with --- the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. -DROP - INDEX IF EXISTS osm_linestring_geom_index; - -DROP - INDEX IF EXISTS osm_linestring_tags_index; - -REFRESH MATERIALIZED VIEW osm_linestring; - -CREATE - INDEX IF NOT EXISTS osm_linestring_geom_index ON - osm_linestring - USING gist(geom); - -CREATE - INDEX IF NOT EXISTS osm_linestring_tags_index ON - osm_linestring - USING gin(tags); diff --git a/basemap/layers/polygon/refresh.sql b/basemap/layers/polygon/refresh.sql deleted file mode 100644 index 076a304e2..000000000 --- a/basemap/layers/polygon/refresh.sql +++ /dev/null @@ -1,31 +0,0 @@ --- Licensed to the Apache Software Foundation (ASF) under one or more --- contributor license agreements. See the NOTICE file distributed with --- this work for additional information regarding copyright ownership. --- The ASF licenses this file to you under the Apache License, Version 2.0 --- (the "License"); you may not use this file except in compliance with --- the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. -DROP - INDEX IF EXISTS osm_polygon_geom_idx; - -DROP - INDEX IF EXISTS osm_polygon_tags_idx; - -REFRESH MATERIALIZED VIEW osm_polygon; - -CREATE - INDEX osm_polygon_geom_idx ON - osm_polygon - USING GIST(geom); - -CREATE - INDEX osm_polygon_tags_idx ON - osm_polygon - USING GIN(tags); \ No newline at end of file diff --git a/basemap/refresh.js b/basemap/refresh.js index b485b3477..4b650b725 100644 --- a/basemap/refresh.js +++ b/basemap/refresh.js @@ -26,8 +26,6 @@ export default { // "layers/way/refresh.sql", // "layers/relation/refresh.sql", // "layers/member/refresh.sql", - // "layers/linestring/refresh.sql", - // "layers/polygon/refresh.sql", // "layers/highway/refresh.sql", // "layers/landuse/refresh.sql", // "layers/leisure/refresh.sql",