-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (28 loc) · 1.22 KB
/
Makefile
File metadata and controls
38 lines (28 loc) · 1.22 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
include .env
# THIS FILE IS ONLY SUITABLE FOR LOCAL DEVELOPMENT - WIP
test:
go test ./internal/... -v
build:
go build -o main ./cmd/bot/main.go
run:
go run ./cmd/bot/main.go
migration-version-apply:
@bash -c 'read -p "Please provide migration version to force: " version && \
echo $$version && \
migrate -path ./internal/db/migrations -database "postgresql://${DB_USER}:${DB_PASSWORD}@localhost:5432/${DB_NAME}?sslmode=disable" force $$version'
create-migration:
@bash -c 'read -p "Please provide migration name: " name && \
echo $$name && \
migrate create -ext sql -dir ./internal/db/migrations/ -seq $$name'
create-dump:
DB_USER=${DB_USER} DB_NAME=${DB_NAME} sh ./scripts/db/create_dump.sh
apply-dump:
DB_USER=${DB_USER} DB_NAME=${DB_NAME} sh ./scripts/db/find_apply_dump.sh
generate-coverage:
go test -v -coverprofile ./tmp/coverage.out ./internal/... && \
go tool cover -html=./tmp/coverage.out -o ./tmp/coverage.html && \
google-chrome ./tmp/coverage.html
migration-down: create-dump
migrate -path ./internal/db/migrations -database "postgresql://${DB_USER}:${DB_PASSWORD}@localhost:5432/${DB_NAME}?sslmode=disable" -verbose \
down
.PHONY: build run migration-down apply-dump create-migration generate-html-coverage