-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (26 loc) · 997 Bytes
/
Makefile
File metadata and controls
39 lines (26 loc) · 997 Bytes
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
DB_URL=postgresql://root:c4X1BtFHi60rON@localhost:5432/dnsbin?sslmode=disable
network:
docker network create dnsbin-network
postgres:
docker run --name postgres --network dnsbin-network -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=c4X1BtFHi60rON -d postgres:latest
createdb:
docker exec -it postgres createdb --username=root --owner=root dnsbin
dropdb:
docker exec -it postgres dropdb dnsbin
migrateup:
migrate -path db/migration -database "$(DB_URL)" -verbose up
migrateup1:
migrate -path db/migration -database "$(DB_URL)" -verbose up 1
migratedown:
migrate -path db/migration -database "$(DB_URL)" -verbose down
migratedown1:
migrate -path db/migration -database "$(DB_URL)" -verbose down 1
new_migration:
migrate create -ext sql -dir db/migration -seq $(name)
sqlc:
sqlc generate
test:
go test -v -cover -short ./...
server:
go run main.go
.PHONY: network postgres createdb dropdb migrateup migratedown migrateup1 migratedown1 new_migration sqlc test server