-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (31 loc) · 998 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
39
40
41
42
postgres:
docker run --name postgres15 -p 5433:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres:15-alpine
create_db:
docker exec -it postgres15 createdb --username=root --owner=root simple_bank
drop_db:
docker exec -it postgres15 dropdb simple_bank
migrate_up:
migrate -path db/migrations -database "postgresql://root:secret@localhost:5433/simple_bank?sslmode=disable" -verbose up $(count)
migrate_down:
migrate -path db/migrations -database "postgresql://root:secret@localhost:5433/simple_bank?sslmode=disable" -verbose down $(count)
sqlc_init:
docker run --rm -v $(CURDIR):/src -w /src kjconroy/sqlc init
sqlc_generate:
docker run --rm -v $(CURDIR):/src -w /src kjconroy/sqlc generate
test:
go test -v -cover ./...
server:
go run main.go
mock:
mockgen -package mockdb -destination db/mock/store.go github.com/urunsiyabend/simple_bank/db/sqlc Store
.PHONY:
postgres
create_db
drop_db
migrate_up
migrate_down
sqlc_init
sqlc_generate
test
server
mock