From cd2e424a6d81a99e2f810c8fdbed6ebf5ae03664 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Wed, 1 Jan 2025 02:43:37 +0100 Subject: [PATCH] made sure that osm data is not required to run the server --- docker-compose.local.yml | 2 -- ...4407c21e4c984144695bc3b0c2d5be6993126dbc1c.json | 14 -------------- ...63ffb7b4c2fc176afcb13a19cc0d3b7c05dd7b2935.json | 12 ------------ ...17a331620a7d6f95d3662b197b0b0b262247b73fde.json | 12 ------------ server/src/maps/refresh.rs | 4 ++-- 5 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 server/.sqlx/query-064abe062d039025429a814407c21e4c984144695bc3b0c2d5be6993126dbc1c.json delete mode 100644 server/.sqlx/query-53d3b9186aee2a124a637563ffb7b4c2fc176afcb13a19cc0d3b7c05dd7b2935.json delete mode 100644 server/.sqlx/query-5a04e858b65dd2a5c7891f17a331620a7d6f95d3662b197b0b0b262247b73fde.json diff --git a/docker-compose.local.yml b/docker-compose.local.yml index ad5382392..2d045eae9 100644 --- a/docker-compose.local.yml +++ b/docker-compose.local.yml @@ -46,8 +46,6 @@ services: depends_on: meilisearch: condition: service_healthy - osm2pgsql-init: - condition: service_completed_successfully db: condition: service_healthy meilisearch: diff --git a/server/.sqlx/query-064abe062d039025429a814407c21e4c984144695bc3b0c2d5be6993126dbc1c.json b/server/.sqlx/query-064abe062d039025429a814407c21e4c984144695bc3b0c2d5be6993126dbc1c.json deleted file mode 100644 index 4e09f8fb2..000000000 --- a/server/.sqlx/query-064abe062d039025429a814407c21e4c984144695bc3b0c2d5be6993126dbc1c.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n WITH rows_to_delete AS (\n SELECT id\n FROM calendar WHERE room_code = $1\n LIMIT 1000\n )\n \n DELETE FROM calendar\n WHERE id IN (SELECT id FROM rows_to_delete);", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [] - }, - "hash": "064abe062d039025429a814407c21e4c984144695bc3b0c2d5be6993126dbc1c" -} diff --git a/server/.sqlx/query-53d3b9186aee2a124a637563ffb7b4c2fc176afcb13a19cc0d3b7c05dd7b2935.json b/server/.sqlx/query-53d3b9186aee2a124a637563ffb7b4c2fc176afcb13a19cc0d3b7c05dd7b2935.json deleted file mode 100644 index e54bcb037..000000000 --- a/server/.sqlx/query-53d3b9186aee2a124a637563ffb7b4c2fc176afcb13a19cc0d3b7c05dd7b2935.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n with max_version(max_import_version) as (SELECT MAX(import_version) from indoor_features i2),\n groups_with_outdated_version(group_id, import_version) as (SELECT group_id, import_version\n from indoor_features,\n max_version\n where import_version < max_import_version)\n\n DELETE\n FROM indoor_features\n where group_id in (select group_id from groups_with_outdated_version)\n and import_version in (select distinct import_version from groups_with_outdated_version);", - "describe": { - "columns": [], - "parameters": { - "Left": [] - }, - "nullable": [] - }, - "hash": "53d3b9186aee2a124a637563ffb7b4c2fc176afcb13a19cc0d3b7c05dd7b2935" -} diff --git a/server/.sqlx/query-5a04e858b65dd2a5c7891f17a331620a7d6f95d3662b197b0b0b262247b73fde.json b/server/.sqlx/query-5a04e858b65dd2a5c7891f17a331620a7d6f95d3662b197b0b0b262247b73fde.json deleted file mode 100644 index ce58a01a9..000000000 --- a/server/.sqlx/query-5a04e858b65dd2a5c7891f17a331620a7d6f95d3662b197b0b0b262247b73fde.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n WITH max_version(max_import_version) AS (SELECT MAX(import_version) FROM indoor_features i2),\n geometry(gid, geom, tags) AS (SELECT way_id AS gid, geom, tags\n FROM indoor_ways\n UNION\n DISTINCT\n SELECT area_id AS gid, geom, tags\n FROM indoor_polygons\n UNION\n DISTINCT\n SELECT node_id AS gid, geom, tags\n FROM indoor_nodes),\n geometry_in_lat_lon(gid, geom, tags) AS (SELECT gid, ST_Transform(geom, 4326), tags FROM geometry),\n -- clustered to within about ~20m of non-overlapping distance\n clustered_geometry(gid, group_id, geom, tags)\n AS (SELECT gid,\n ST_ClusterWithinWin(geom, 0.0001) OVER () AS group_id,\n geom,\n tags\n FROM geometry_in_lat_lon),\n clustered_features(group_id, features) AS (SELECT group_id,\n jsonb_build_object(\n 'type', 'Feature',\n 'id', gid,\n 'geometry', ST_AsGeoJSON(geom)::jsonb,\n 'properties', tags\n ),\n geom\n FROM clustered_geometry),\n grouped_features(group_id, features, convex_hull) AS (SELECT group_id,\n jsonb_agg(features),\n ST_ConvexHull(ST_Collect(array_agg(geom)))::geometry\n FROM clustered_features\n GROUP BY group_id\n ORDER BY group_id)\n\nINSERT\nINTO indoor_features(group_id, features, convex_hull, import_version)\nSELECT group_id, jsonb_build_object('type', 'FeatureCollection','features', features), convex_hull, COALESCE(max_import_version,-1) + 1\nFROM grouped_features, max_version\n", - "describe": { - "columns": [], - "parameters": { - "Left": [] - }, - "nullable": [] - }, - "hash": "5a04e858b65dd2a5c7891f17a331620a7d6f95d3662b197b0b0b262247b73fde" -} diff --git a/server/src/maps/refresh.rs b/server/src/maps/refresh.rs index 70d16877f..feb5a8bf2 100644 --- a/server/src/maps/refresh.rs +++ b/server/src/maps/refresh.rs @@ -12,7 +12,7 @@ pub async fn all_entries(pool: &PgPool) { } async fn repopulate_indoor_features(pool: &PgPool) -> sqlx::Result<()> { - sqlx::query!(r#" + sqlx::query(r#" with max_version(max_import_version) as (SELECT MAX(import_version) from indoor_features i2), groups_with_outdated_version(group_id, import_version) as (SELECT group_id, import_version from indoor_features, @@ -25,7 +25,7 @@ async fn repopulate_indoor_features(pool: &PgPool) -> sqlx::Result<()> { and import_version in (select distinct import_version from groups_with_outdated_version);"#) .execute(pool) .await?; - sqlx::query!(r#" + sqlx::query(r#" WITH max_version(max_import_version) AS (SELECT MAX(import_version) FROM indoor_features i2), geometry(gid, geom, tags) AS (SELECT way_id AS gid, geom, tags FROM indoor_ways