-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
41 lines (28 loc) · 984 Bytes
/
Makefile
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
33
34
35
36
37
38
39
40
41
TESTS = $(find tests -name test_\*.sql)
PGHOST = localhost
PGPORT = 5432
PGPASSWORD = unsafe
PGUSER = postgres
clean:
psql -c "DROP SCHEMA IF EXISTS _rrule CASCADE" -h ${PGHOST} -p ${PGPORT} -U ${PGUSER}
schema:
cat src/schema.sql >> postgres-rrule.sql
types:
find src/types -name \*.sql | sort | xargs -I % cat % >> postgres-rrule.sql
functions:
find src/functions -name \*.sql| sort | xargs -I % cat % >> postgres-rrule.sql
operators:
find src/operators -name \*.sql | sort | xargs -I % cat % >> postgres-rrule.sql
casts:
find src/casts -name \*.sql | sort | xargs -I % cat % >> postgres-rrule.sql
test:
pg_prove -h ${PGHOST} -p ${PGPORT} -U ${PGUSER} tests/test_*.sql
rm_rules:
rm -f postgres-rrule.sql
compile: rm_rules schema types functions operators casts
execute:
psql -X -f postgres-rrule.sql -h ${PGHOST} -p ${PGPORT} -U ${PGUSER}
dev: execute
pgtap:
psql -c "CREATE EXTENSION pgtap;" -h ${PGHOST} -p ${PGPORT} -U ${PGUSER}
all: compile execute