-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (33 loc) · 929 Bytes
/
Makefile
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
.PHONY: up down build test migrate
# Install dependencies
install:
brew bundle
# Start all services
up:
docker-compose up --build -d
# Stop all services
down:
docker-compose down
# Remove volumes via docker-compose
remove-volumes:
docker-compose down -v
# Build the Go application
build:
go build -o bin/server ./cmd/server/main.go
# Create a new migration
migrate-create:
@read -p "Enter migration name: " name; \
migrate create -ext sql -dir migrations -seq $$name
# Apply migrations
migrate-up:
migrate -path migrations -database "postgresql://postgres:postgres@localhost:5432/uptime?sslmode=disable" up
# Rollback migrations
migrate-down:
migrate -path migrations -database "postgresql://postgres:postgres@localhost:5432/uptime?sslmode=disable" down
# DB shell
db-shell:
docker-compose exec db psql -U postgres -d uptime
# Stop all services and remove volumes
down-clean:
make down
make remove-volumes