-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (23 loc) · 817 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
ifneq (,$(wildcard ./app.env))
include app.env
export
endif
postgres:
docker run --name simplebank-db -p $(DB_PORT):5432 -e POSTGRES_PASSWORD=$(DB_PASSWORD) -e POSTGRES_USER=$(DB_USER) -d postgres:16-alpine
createdb:
docker exec -it simplebank-db createdb --username=$(DB_USER) --owner=$(DB_USER) $(DB_NAME)
dropdb:
docker exec -it simplebank-db dropdb --username=$(DB_USER) $(DB_NAME)
migrateup:
migrate -path sql/migrations -database $(DB_URL) -verbose up
migratedown:
migrate -path sql/migrations -database $(DB_URL) -verbose down
sqlc:
sqlc generate
test:
go test -v ./...
mock:
mockgen -package mockdb -destination pkg/mockdb/store.go github.com/aseerkt/go-simple-bank/pkg/db Store
server:
go run cmd/server/main.go
.PHONY: postgres createdb dropdb migrateup migratedown sqlc test mock