-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (29 loc) · 912 Bytes
/
Makefile
File metadata and controls
32 lines (29 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PG_HOST ?= localhost
PG_NAME ?= filestore
PG_USER ?= postgres
PG_PASS ?=
SCRIPTS = ./scripts
init:
for file in $(SCRIPTS)/init/* ; do \
if test "$(PG_HOST)" = "localhost"; then \
PGPASSWORD=$(PG_PASS) psql -U $(PG_USER) -a -f $${file} ; \
else \
PGPASSWORD=$(PG_PASS) psql -U $(PG_USER) -h $(PG_HOST) -d postgres -a -f $${file} ; \
fi; \
done
schema:
for file in $(SCRIPTS)/schema/* ; do \
if test "$(PG_HOST)" = "localhost"; then \
PGPASSWORD=$(PG_PASS) psql -U $(PG_USER) -d $(PG_NAME) -a -f $${file} ; \
else \
PGPASSWORD=$(PG_PASS) psql -U $(PG_USER) -h $(PG_HOST) -d $(PG_NAME) -a -f $${file} ; \
fi; \
done
reset:
for file in $(SCRIPTS)/reset/* ; do \
if test "$(PG_HOST)" = "localhost"; then \
PGPASSWORD=$(PG_PASS) psql -U $(PG_USER) -a -f $${file} ; \
else \
PGPASSWORD=$(PG_PASS) psql -U $(PG_USER) -h $(PG_HOST) -d postgres -a -f $${file} ; \
fi; \
done