-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
54 lines (41 loc) · 1.37 KB
/
Copy pathmakefile
File metadata and controls
54 lines (41 loc) · 1.37 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
all: build
setup:
@go get tool
@go install github.com/swaggo/swag/cmd/swag@latest
@cd ui && pnpm install
build:
@go build -o main cmd/api/main.go
run:
@go run cmd/api/main.go
watch:
@docker compose up backend frontend
@docker compose down
swagger:
@swag fmt -g ./internal/server/api/v1/v1.go
@swag init -q -g ./internal/server/api/v1/v1.go -o ./docs/v1/
seed:
@docker compose up --abort-on-container-exit --exit-code-from seed seed
@docker compose down
goose:
@docker compose down
@docker compose up db -d
@docker compose exec db bash -c 'until pg_isready -U postgres; do sleep 1; done'
@read -p "Action: " action; \
go tool goose -dir ./db/migrations postgres "user=postgres password=postgres host=localhost port=5432 dbname=events sslmode=disable" $$action
@docker compose down db
migrate:
@docker compose down
@docker compose up db -d
@docker compose exec db bash -c 'until pg_isready -U postgres; do sleep 1; done'
@go tool goose -dir ./db/migrations postgres "user=postgres password=postgres host=localhost port=5432 dbname=events sslmode=disable" up
@docker compose down db
create-migration:
@read -p "Enter migration name: " name; \
go tool goose -dir ./db/migrations create $$name sql
query:
@go tool sqlc generate
test:
go test ./..
dead:
go tool deadcode ./...
.PHONY: all setup build run watch swagger seed goose migrate create-migration query test dead