feat: renamed script/create-distance-table.sh to script/create-distances-table.sh
This commit is contained in:
parent
8fa7b43208
commit
094e2abfe6
|
@ -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.
|
|
@ -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;
|
|
@ -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;
|
||||
---
|
||||
|
|
Loading…
Reference in New Issue