-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (31 loc) · 1.09 KB
/
Copy pathMakefile
File metadata and controls
39 lines (31 loc) · 1.09 KB
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
POSTGRES_DSN=postgres://postgres:postgres@localhost:5433/postgres?sslmode=disable
MIGRATION_DIR=db/migration
.PHONY: test
test:
go test -v -cover -short ./...
.PHONY: test-coverage
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated in coverage.html"
.PHONY: server
server:
go run cmd/main.go
.PHONY: db-status
db-status:
GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(POSTGRES_DSN) goose -dir=$(MIGRATION_DIR) status
.PHONY: migrate-up
migrate-up:
GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(POSTGRES_DSN) goose -dir=$(MIGRATION_DIR) up
.PHONY: migrate-down
migrate-down:
GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(POSTGRES_DSN) goose -dir=$(MIGRATION_DIR) down
.PHONY: migrate-reset
migrate-reset:
GOOSE_DRIVER=postgres GOOSE_DBSTRING=$(POSTGRES_DSN) goose -dir=$(MIGRATION_DIR) reset
.PHONY: migrate-create
migrate-create:
ifndef name
$(error name is required, use: `make migrate-create name=your_migration_name`)
endif
GOOSE_DRIVER=sqlite3 GOOSE_DBSTRING=$(POSTGRES_DSN) goose -dir $(MIGRATION_DIR) create "$(name)" sql