-include .env export BINARY = bin/api DB_URL ?= postgres://account:account@localhost:5432/account?sslmode=disable GOBIN = $(shell go env GOPATH)/bin MIGRATE = $(GOBIN)/migrate SQLC = $(GOBIN)/sqlc .PHONY: build run test docker-up docker-down migrate-up migrate-down migrate-create sqlc-gen build: go build -o $(BINARY) ./cmd/api run: go run ./cmd/api test: go test ./... ## Docker docker-up: docker compose up -d docker-down: docker compose down docker-reset: docker compose down -v ## Migrations (nécessite: go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest) migrate-up: $(MIGRATE) -path migrations -database "$(DB_URL)" up migrate-down: $(MIGRATE) -path migrations -database "$(DB_URL)" down 1 migrate-create: @test -n "$(name)" || (echo "usage: make migrate-create name=xxx" && exit 1) $(MIGRATE) create -ext sql -dir migrations -seq $(name) ## sqlc (nécessite: go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest) sqlc-gen: $(SQLC) generate