-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (29 loc) · 892 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
ifneq (,$(wildcard ./.env))
include .env
export
endif
.PHONY: welcome
welcome:
@echo "**********************************************************"
@echo "************* Welcome to my first api in go ************"
@echo "**********************************************************"
GOOSE=goose
DB_URL=postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable
.PHONY: test
test:
go test ./... -v
test-cover:
go test -cover ./...
run-api:
go run cmd/api/main.go
migrate-status:
$(GOOSE) -dir ./migrations postgres "$(DB_URL)" status
migrate-reset:
$(GOOSE) -dir ./migrations postgres "$(DB_URL)" reset
migrate-up:
$(GOOSE) -dir ./migrations postgres "$(DB_URL)" up
migrate-down:
$(GOOSE) -dir ./migrations postgres "$(DB_URL)" down
migrate-create:
@read -p "Enter migration name: " name; \
$(GOOSE) -dir ./migrations create $$name sql