fix(db): make sql scripts consistent

This commit is contained in:
dancingCycle 2023-07-31 17:17:32 +02:00
parent b7dd7362e3
commit 2eaa603448
2 changed files with 8 additions and 8 deletions

View File

@ -2,10 +2,10 @@
CREATE SCHEMA IF NOT EXISTS :schema;
SET search_path to :schema, public;
DROP TABLE IF EXISTS :schema.tbl_sale_points;
DROP VIEW IF EXISTS :schema.vw_sale_points;
DROP TABLE IF EXISTS :schema.tbl_vending_machine;
DROP VIEW IF EXISTS :schema.vw_vending_machine;
CREATE OR REPLACE VIEW :schema.vw_sale_points AS
CREATE OR REPLACE VIEW :schema.vw_vending_machine AS
SELECT entity.osm_id, entity.amenity, entity.name, entity.st_x, entity.st_y
FROM (
--planet_osm_point/node
@ -36,4 +36,4 @@ LEFT JOIN vw_municipalities vwm ON st_contains(vwm.way, st_transform(st_geomfrom
WHERE (vwc.name = ANY (ARRAY['Braunschweig','Salzgitter','Wolfsburg','Gifhorn','Landkreis Goslar','Landkreis Helmstedt','Landkreis Peine','Landkreis Wolfenbüttel']))
ORDER BY vwc.name, vwm.name, entity.name;
CREATE TABLE IF NOT EXISTS :schema.tbl_sale_points AS SELECT * FROM :schema.vw_sale_points;
CREATE TABLE IF NOT EXISTS :schema.tbl_vending_machine AS SELECT * FROM :schema.vw_vending_machine;

View File

@ -2,10 +2,10 @@
CREATE SCHEMA IF NOT EXISTS :schema;
SET search_path to :schema, public;
DROP TABLE IF EXISTS :schema.tbl_sale_points;
DROP VIEW IF EXISTS :schema.vw_sale_points;
DROP TABLE IF EXISTS :schema.tbl_shop_ticket;
DROP VIEW IF EXISTS :schema.vw_shop_ticket;
CREATE OR REPLACE VIEW :schema.vw_sale_points AS
CREATE OR REPLACE VIEW :schema.vw_shop_ticket AS
SELECT entity.osm_id, entity."tickets:public_transport", entity.name, entity.st_x, entity.st_y
FROM (
--planet_osm_point/node
@ -38,4 +38,4 @@ LEFT JOIN vw_municipalities vwm ON st_contains(vwm.way, st_transform(st_geomfrom
WHERE (vwc.name = ANY (ARRAY['Braunschweig','Salzgitter','Wolfsburg','Gifhorn','Landkreis Goslar','Landkreis Helmstedt','Landkreis Peine','Landkreis Wolfenbüttel']))
ORDER BY vwc.name, vwm.name, entity.name;
CREATE TABLE IF NOT EXISTS :schema.tbl_sale_points AS SELECT * FROM :schema.vw_sale_points;
CREATE TABLE IF NOT EXISTS :schema.tbl_shop_ticket AS SELECT * FROM :schema.vw_shop_ticket;