-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (41 loc) · 1.2 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
export GOOSE_MIGRATION_DIR ?= ./database/migrations
export GOOSE_DRIVER ?= postgres
export GOOSE_DBSTRING ?= host=localhost port=5432 user=postgres password=postgres dbname=templateapi sslmode=disable
.SILENT:
run:
if ! [ -f ./config/config.dev.yml ]; \
then \
go run ./main.go; \
else \
go run ./main.go --config-file=./config/config.dev.yml; \
fi
# The name argument is specified as: make migration NAME="name-of-the-migration"
migration:
goose create $(NAME) sql
migrations_up:
goose up
migrations_up_by_one:
goose up-by-one
# The version argument is specified as: make migrations_down_to VERSION="<name-of-migration>.sql"
migrations_up_to:
goose up-to $(VERSION)
migrations_down:
goose down
# The version argument is specified as: make migrations_down_to VERSION="<name-of-migration>.sql"
migrations_down_to:
goose down-to $(VERSION)
db_status:
goose status
reset_db:
goose reset
watch:
if ! [ -f ./config/config.dev.yml ]; \
then \
gow -c -v -r=false run ./main.go; \
else \
gow -c -v -r=false run ./main.go --config-file=./config/config.dev.yml; \
fi
lint:
golangci-lint run --allow-parallel-runners --fix
test:
go test ./internal/... -race -coverprofile=fmt.coverage