-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (32 loc) · 825 Bytes
/
Copy pathMakefile
File metadata and controls
46 lines (32 loc) · 825 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
40
41
42
43
44
45
46
ifneq (,$(wildcard .env))
include .env
export
endif
MIGRATIONS := internal/db/migrations
.PHONY: build run test vet tidy sqlc migrate migrate-up migrate-down migrate-force pg-up pg-down
build:
go build ./...
run:
go run ./cmd/mellow
migrate:
MELLOW_MIGRATE_ONLY=1 go run ./cmd/mellow
test:
go test ./...
vet:
go vet ./...
tidy:
go mod tidy
sqlc:
sqlc generate
migrate-up:
migrate -path $(MIGRATIONS) -database "$(DATABASE_URL)" up
migrate-down:
migrate -path $(MIGRATIONS) -database "$(DATABASE_URL)" down 1
migrate-force:
migrate -path $(MIGRATIONS) -database "$(DATABASE_URL)" force $(V)
pg-up:
docker run -d --name $(PG_CONTAINER) -p $(PG_PORT):5432 \
-e POSTGRES_USER=$(PG_USER) -e POSTGRES_PASSWORD=$(PG_PASSWORD) -e POSTGRES_DB=$(PG_DB) \
$(PG_IMAGE)
pg-down:
docker rm -f $(PG_CONTAINER)