From 094e2abfe6b5c302c5e86994f6d50ec534e32869 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Fri, 22 Sep 2023 14:44:23 +0200 Subject: [PATCH] feat: renamed script/create-distance-table.sh to script/create-distances-table.sh --- .../{create-distance-table.sh => create-distances-table.sh} | 2 +- sql/{create-distance-table.sql => create-distances-table.sql} | 4 ++-- sql/create-entities-table.sql | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename script/{create-distance-table.sh => create-distances-table.sh} (76%) rename sql/{create-distance-table.sql => create-distances-table.sql} (70%) diff --git a/script/create-distance-table.sh b/script/create-distances-table.sh similarity index 76% rename from script/create-distance-table.sh rename to script/create-distances-table.sh index df896c8..8c3e249 100755 --- a/script/create-distance-table.sh +++ b/script/create-distances-table.sh @@ -16,7 +16,7 @@ echo "DB_USER: $DB_USER" DB_SCHEMA="$3" echo "DB_SCHEMA: ${DB_SCHEMA}" # -psql -h localhost -p 5432 -U $DB_USER -f ./sql/create-distance-table.sql -d $DB_NAME -v schema=$DB_SCHEMA +psql -h localhost -p 5432 -U $DB_USER -f ./sql/create-distances-table.sql -d $DB_NAME -v schema=$DB_SCHEMA # echo "Done." #Done. diff --git a/sql/create-distance-table.sql b/sql/create-distances-table.sql similarity index 70% rename from sql/create-distance-table.sql rename to sql/create-distances-table.sql index 60eb074..9cbb781 100644 --- a/sql/create-distance-table.sql +++ b/sql/create-distances-table.sql @@ -2,8 +2,8 @@ CREATE SCHEMA IF NOT EXISTS :schema; SET search_path to :schema, public; ---create view -CREATE OR REPLACE VIEW :schema.vw_distance AS +CREATE OR REPLACE VIEW :schema.vw_distances AS SELECT relation_id, en_from_name, en_from_lon, en_from_lat, en_to_name, en_to_lon, en_to_lat, ST_DistanceSphere(ST_MakePoint(en_from_lon, en_from_lat), ST_MakePoint(en_to_lon, en_to_lat)) AS dist FROM tbl_relations_coord; ---create table -CREATE TABLE IF NOT EXISTS :schema.tbl_distance AS SELECT * FROM :schema.vw_distance; +CREATE TABLE IF NOT EXISTS :schema.tbl_distances AS SELECT * FROM :schema.vw_distances; diff --git a/sql/create-entities-table.sql b/sql/create-entities-table.sql index fafae36..9ff918d 100644 --- a/sql/create-entities-table.sql +++ b/sql/create-entities-table.sql @@ -1,5 +1,5 @@ --- -DROP TABLE IF EXISTS tbl_distance CASCADE; +DROP TABLE IF EXISTS tbl_distances CASCADE; --- DROP TABLE IF EXISTS tbl_relations_coord CASCADE; ---