Project

General

Profile

1 225 aaronmk
export PGOPTIONS = --client-min-messages=WARNING
2
3
psqlOpts = --set ON_ERROR_STOP=1 --quiet
4
psqlAdmin = sudo -u postgres psql $(psqlOpts)
5
psqlDbUser = ./util/psql_vegbien $(psqlOpts)
6
7 202 aaronmk
all: install
8 149 aaronmk
9 225 aaronmk
.SUFFIXES:
10
11 202 aaronmk
FORCE:
12 225 aaronmk
.PHONY: FORCE
13 202 aaronmk
14
15
install: user db
16
17
uninstall: rm_db rm_user
18
19 225 aaronmk
reinstall: uninstall install
20
21 202 aaronmk
reinstall_db: rm_db db
22
23 225 aaronmk
empty_db:
24
	$(psqlDbUser) <../mappings/schemas/vegbien_empty.sql
25 202 aaronmk
26
user: FORCE
27
	-./admin/bien_user_create
28
# ignore errors about existing user
29
30
rm_user: FORCE
31 225 aaronmk
	echo "DROP USER bien;"|$(psqlAdmin)
32 202 aaronmk
33
db: FORCE
34 225 aaronmk
	$(psqlAdmin) <../mappings/schemas/vegbien.sql
35 202 aaronmk
36
rm_db: FORCE
37 225 aaronmk
	echo "DROP DATABASE vegbien;"|$(psqlAdmin)
38 202 aaronmk
39
40 176 aaronmk
test: test-map
41 149 aaronmk
42 176 aaronmk
test-%: FORCE
43
	./test/$(*F)