-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (29 loc) · 963 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
PROJECT_NAME := bank-account
.PHONY: help
help: ## Show this help.
@echo "Choose a command run in "$(PROJECT_NAME)":"
@echo ""
@echo "Usage: make [command]"
@echo ""
@echo "Commands:"
@echo " db/start Start database"
@echo " db/migrate Run database migrations"
@echo " db/rollback Rollback database migrations"
@echo " run Run application"
@echo " test Run tests"
@echo ""
.PHONY: db/start
db/start:
docker run --name postgres -p 5432:5432 -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin -e POSTGRES_DATABASE=account -d postgres:latest
.PHONY: db/migrate
db/migrate:
migrate -path migrations -database "postgresql://admin:admin@localhost:5432/account?sslmode=disable" -verbose up
.PHONY: db/rollback
db/rollback:
migrate -path migrations -database "postgresql://admin:admin@localhost:5432/account?sslmode=disable" -verbose down
.PHONY: run
run:
go run main.go
.PHONY: test
test:
go test -v ./...