-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
31 lines (24 loc) · 764 Bytes
/
makefile
File metadata and controls
31 lines (24 loc) · 764 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
include .envrc
MIGRATIONS_PATH = ./cmd/migrate/migrations/
export DB_ADDR = postgres://Karthik:123@localhost/social?sslmode=disable
.PHONY: migrate-create
migration:
@migrate create -seq -ext sql -dir $(MIGRATIONS_PATH) $(filter-out $@,$(MAKECMDGOALS))
.PHONY: migrate-up
migrate-up:
@migrate -path $(MIGRATIONS_PATH) -database $(DB_ADDR) up
.PHONY: migrate-down
migrate-down:
@migrate -path $(MIGRATIONS_PATH) -database $(DB_ADDR) down $(filter-out $@,$(MAKECMDGOALS))
.PHONY: seed
seed:
@go run cmd/migrate/seed/main.go
.PHONY: gen-docs
gen-docs:
@swag init -g ./main.go -d ./cmd/api,./internal && swag fmt
.PHONY: migrate-force
migrate-force:
@migrate -path $(MIGRATIONS_PATH) -database $(DB_ADDR) force $(ARG)
.PHONY: test
test:
@go test -v ./...