feat: adjust makefile

This commit is contained in:
dancingCycle 2023-05-09 11:08:09 +02:00
parent 7ce7e98a1e
commit b96accf9bf
2 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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
```
```
* load database
```
cd ~/git/zhv
make load GTFS=<zip file>