-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (39 loc) · 2.36 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
55
56
57
58
59
60
postgres:
docker run --name postgresdb -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d postgres
createdb:
docker exec -it postgresdb createdb --username=postgres --owner=postgres go_simple_bank
dropdb:
docker exec -it postgresdb dropdb --username=postgres go_simple_bank
psql:
docker exec -it postgresdb psql -U postgres
bash:
docker exec -it postgresdb bash
migrateup:
docker run -v /Users/emeruche/Practice/go-bank-api/db/migrations:/migrations --network host migrate/migrate -path=/migrations/ -database "postgresql://postgres:postgres@localhost:5432/go_simple_bank?sslmode=disable" up
migrateup_last:
docker run -v /Users/emeruche/Practice/go-bank-api/db/migrations:/migrations --network host migrate/migrate -path=/migrations/ -database "postgresql://postgres:postgres@localhost:5432/go_simple_bank?sslmode=disable" up 1
migratedown:
docker run -v /Users/emeruche/Practice/go-bank-api/db/migrations:/migrations --network host migrate/migrate -path=/migrations/ -database "postgresql://postgres:postgres@localhost:5432/go_simple_bank?sslmode=disable" down -all
migratedown_last:
docker run -v /Users/emeruche/Practice/go-bank-api/db/migrations:/migrations --network host migrate/migrate -path=/migrations/ -database "postgresql://postgres:postgres@localhost:5432/go_simple_bank?sslmode=disable" down 1
ci_migrateup:
migrate -path db/migrations/ -database "postgresql://postgres:postgres@localhost:5432/go_simple_bank?sslmode=disable" -verbose up
ci_migratedown:
migrate -path db/migrations/ -database "postgresql://postgres:postgres@localhost:5432/go_simple_bank?sslmode=disable" -verbose down -all
sqlc_init:
/Users/emeruche/go/bin/sqlc init
sqlc_generate:
/Users/emeruche/go/bin/sqlc generate
test:
go test -v -cover ./...
server:
go run main.go
mock:
mockgen -destination db/mock/store.go --package mockdb github.com/uchennaemeruche/go-bank-api/db/sqlc Store
docker_build:
docker build -t simplebank:latest .
docker_run:
docker run --name simplebank -p 8080:8080 --network go-bank-api_app-tier -e GIN_MODE=release -e DB_SOURCE="postgresql://postgres:postgres@go-bank-api_postgresdb_1:5432/go_simple_bank?sslmode=disable" simplebank:latest
db_docs:
dbdocs build db/docs/database.dbml
.PHONY: postgres createdb dropdb psql bash migrateup migrateup_last migratedown migratedown_last sqlcinit sqlc_generate server mock docker_build docker_run db_docs