-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
40 lines (31 loc) · 835 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
MIG := @migrate
NODEMON := @nodemon
SIGNAL := SIGTERM
DSN := postgres://restuwahyu13:restuwahyu13@localhost:5432/postgres?sslmode=disable
MIGDIR := databases/migrations/
dev:
${NODEMON} -V -x go run --race *.go --signal ${SIGNAL}
build:
go build -v -race main.go
migmake:
ifdef name
${MIG} -verbose create -ext sql -dir ${MIGDIR} ${name}
endif
migup:
${MIG} -database ${DSN} -path ${MIGDIR} -verbose up
migupf:
ifdef id
${MIG} -database ${DSN} -path ${MIGDIR} -verbose force ${id}
endif
migdown:
${MIG} -database ${DSN} -path ${MIGDIR} -verbose down -all
migupspec:
ifdef target
${MIG} -database ${DSN} -path ${MIGDIR} -verbose down ${target}
endif
migdownspec:
ifdef target
${MIG} -database ${DSN} -path ${MIGDIR} -verbose down ${target}
endif
migdrop:
${MIG} -database ${DSN} -path ${MIGDIR} -verbose drop -f