-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
38 lines (30 loc) · 840 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
# environment for integration testing
ENV_LOCAL_TEST=\
APP_NAME="Golang Rest API" \
APP_PORT=3000 \
APP_PREFORK=false \
APP_TIMEOUT=10 \
DB_USER=root \
DB_PASSWORD= \
DB_HOST=localhost \
DB_PORT=3306 \
DB_NAME=go-rest-api-test \
POOL_IDLE=5 \
POOL_MAX=100 \
POOL_LIFETIME=3000 \
LOG_LEVEL=6 \
JWT_SECRET_KEY=secretkey
test.unit:
go test ./test/unit -v
test.integration:
$(ENV_LOCAL_TEST) go test ./test/integration -v
include .env
DATABASE_URL="mysql://$(DB_USER):$(DB_PASSWORD)@tcp($(DB_HOST):$(DB_PORT))/$(DB_NAME)"
migrate.create:
migrate create -ext sql -dir db/migrations $(name)
migrate.up:
migrate -database $(DATABASE_URL) -path db/migrations up
migrate.down:
migrate -database $(DATABASE_URL) -path db/migrations down
migrate.force:
migrate -database $(DATABASE_URL) -path db/migrations force $(version)