Initial commit
This commit is contained in:
commit
afed023152
8152 files changed
+2086461
No files matched your search
@@ -0,0 +1,52 @@
|
||||
# Backend tasks — run from backend/. `make check` is the gate to run
|
||||
# before declaring any change done.
|
||||
|
||||
.PHONY: help run build test vet fmt fmt-check check tidy \
|
||||
db-up db-down migrate-up migrate-down migrate-status migrate-new
|
||||
|
||||
help: ## List targets
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
run: ## Start the API server (SQLite default — run `make migrate-up` once)
|
||||
go run ./cmd/api
|
||||
|
||||
build: ## Compile the binaries into bin/
|
||||
go build -o bin/api ./cmd/api
|
||||
go build -o bin/migrate ./cmd/migrate
|
||||
|
||||
test: ## Run all tests
|
||||
go test ./...
|
||||
|
||||
vet: ## Run go vet
|
||||
go vet ./...
|
||||
|
||||
fmt: ## Format all source files
|
||||
gofmt -w .
|
||||
|
||||
fmt-check: ## Fail if any file needs gofmt
|
||||
@files=$$(gofmt -l .); if [ -n "$$files" ]; then \
|
||||
echo "gofmt needed on:"; echo "$$files"; exit 1; fi
|
||||
|
||||
check: fmt-check vet test ## Full gate: fmt-check + vet + test
|
||||
|
||||
tidy: ## Tidy go.mod / go.sum
|
||||
go mod tidy
|
||||
|
||||
db-up: ## Optional: start dev Postgres (docker compose) — set DATABASE_URL to use it
|
||||
docker compose up -d --wait db
|
||||
|
||||
db-down: ## Stop the optional dev Postgres and delete its volume
|
||||
docker compose down -v
|
||||
|
||||
migrate-up: ## Apply pending migrations
|
||||
go run ./cmd/migrate up
|
||||
|
||||
migrate-down: ## Roll back the most recent migration group
|
||||
go run ./cmd/migrate down
|
||||
|
||||
migrate-status: ## List migrations and their state
|
||||
go run ./cmd/migrate status
|
||||
|
||||
migrate-new: ## Create a Go migration scaffold: make migrate-new name=create_projects
|
||||
@test -n "$(name)" || (echo "usage: make migrate-new name=create_projects"; exit 2)
|
||||
go run ./cmd/migrate new $(name)
|
||||
Reference in new issue
Block a user