From b96accf9bfbf068320be2eb37907565e75aa67e5 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Tue, 9 May 2023 11:08:09 +0200 Subject: [PATCH] feat: adjust makefile --- makefile | 3 +++ readme.md | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/makefile b/makefile index 5a95861..e6aa0b3 100644 --- a/makefile +++ b/makefile @@ -12,6 +12,9 @@ psql = $(strip psql -v schema=$(SCHEMA)) load: $(addprefix load-,$(TABLES)) @$(psql) -t -A -c "SELECT FORMAT('* loaded %s', feed_file) WHERE feed_file = '$(GTFS)';" +copy: $(ZHV) + $(psql) -c "\copy stops(stop_seq_no,stop_type,stop_dhid,stop_parent,stop_name,stop_lat,stop_lon,stop_municipality_code,stop_municipality,stop_district_code,stop_district,stop_condition,stop_state,stop_description,stop_authority,stop_delfi_name,stop_tariff_dhid,stop_tariff_name) FROM '$<' DELIMITER ',' CSV HEADER;" + # -v: variable assignment, like the /set meta-command # $<: name of the firest prerequisite init: sql/schema.sql diff --git a/readme.md b/readme.md index 19415fd..5d45baf 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,14 @@ cd ~ mkdir ~/git && cd ~/git git clone https://git.wtf-eg.de/dancesWithCycles/zhv.git -cd zhv +cd ~/git/zhv +``` + +* configure cron +``` +cat dload/crontab +crontab -e +crontab -l ``` * make sure to set variables like `PGDATABASE`, `PGUSER`, `PGHOST`, `PGPORT` aaso. appropriately @@ -14,4 +21,10 @@ cd zhv ``` make init -``` \ No newline at end of file +``` + +* load database + +``` +cd ~/git/zhv +make load GTFS= \ No newline at end of file