-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (39 loc) · 1.59 KB
/
Makefile
File metadata and controls
51 lines (39 loc) · 1.59 KB
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
NAME=gobank
VERSION=0.0.1
## deps: Install the dependencies.
deps:
@go mod download
## build: Compile the binary file.
build:
@cd cmd; go build -o ../bin/$(NAME)
## run: Run the web server in development mode.
run: build
@./bin/$(NAME) -e dev
## dev: Run the web server in development mode with a watcher.
## make sure to have https://github.com/githubnemo/CompileDaemon in your device
dev:
@reflex -s -r '\.go$$' make run
## start: Run the web server in production mode.
start:
@./bin/$(NAME) -e prod
## clean: Remove previous build.
clean:
@rm -rf bin
## migrate-create: Create a new migration.
migrate-create:
@migrate create -ext sql -dir database/migrations -seq $(name)
## migrate-up: Run the migrations.
migrate-up:
@migrate -path database/migrations -database "postgres://gobank:root@localhost:5432/gobank-db?sslmode=disable" -verbose up
## migrate-down: Rollback the migrations.
migrate-down:
@migrate -path database/migrations -database "postgres://gobank:root@localhost:5432/gobank-db?sslmode=disable" -verbose down
## migrate-goto: Go to a specific migration version. Use the -v flag to specify the version. (e.g. make migrate-goto v=1)
migrate-goto:
@migrate -path database/migrations -database "postgres://gobank:root@localhost:5432/gobank-db?sslmode=disable" -verbose goto $(v)
## migrate-fix: Force the migrations. Use the -v flag to specify the version.
migrate-fix:
@migrate -path database/migrations -database "postgres://gobank:root@localhost:5432/gobank-db?sslmode=disable" -verbose force $(v)
## test: Run the tests and generate the coverage report.
test:
@go test -v ./... -cover