-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (35 loc) · 1.83 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
createdb:
docker exec -it postgres12 createdb --username=root --owner=root simple_bank
dropdb:
docker exec -it postgres12 dropdb simple_bank
postgres:
docker run --name postgres12 --network smyik-network -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=secret -d postgres:12-alpine
migrateup:
migrate -path ./db/migration/ --database="postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" --verbose up
migrateup1:
migrate -path ./db/migration/ --database="postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" --verbose up 1
migratedown:
migrate -path ./db/migration/ --database="postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" --verbose down
migratedown1:
migrate -path ./db/migration/ --database="postgres://root:secret@localhost:5432/simple_bank?sslmode=disable" --verbose down 1
sqlc:
sqlc generate
test:
go test -v -cover ./... # this means that all the tests in project will run
server:
go run main.go
mock:
mockgen --destination db/mock/store.go --package mockdb github.com/1shubham7/bank/db/sqlc Store
i_love_you:
go fmt ./...
# you can simply run the application by this command
start_app:
docker run --name smyik --network smyik-network -p 8080:8080 -e GIN_MODE=release -e DB_SOURCE="postgresql://root:secret@postgres12:5432/simple_bank?sslmode=disable" smyik:latest
start_prod:
docker run --name smyik --network smyik-network -p 8080:8080 -e GIN_MODE=release -e DB_SOURCE="postgresql://root:secret@postgres12:5432/simple_bank?sslmode=disable" 1shubham7/smyik:v1.0.0
db_docs:
dbdocs build doc/database.dbml --project Smyik
# to generate sql schema from dbml
sql_schema:
dbml2sql --postgres -o doc/schema.sql doc/database.dbml
.PHONY: createdb dropdb postgres migrateup migratedown test server mock i_love_you migrateup1 migratedown1 run_docker_image sqlc db_docs sql_schema