-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
41 lines (35 loc) · 1.39 KB
/
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
#/bin/bash
NAME=name/reminder
BOT_NAME=Od15x4Bot
DSN=postgres://bot:@bot-db:5432/bot?sslmode=disable
NETWORK=15x4
run: up migrate logs
logs:
docker-compose logs -f
up:
docker-compose up --build --force-recreate -d
down:
docker-compose stop $(call name,'')
exec:
docker-compose exec $(call name,'') bash
test:
-@docker-compose run \
--rm \
bot \
go test $(if $(params),$(params),$(shell echo '-cover -race -v ./...'))
shutdown:
# stop containers, remove volumes and containers for services not defined in the compose file
docker-compose down --remove-orphans -v
db-connect:
docker exec -it bot-db psql -U bot -d bot
# migration commands
migrate:
docker run -v $(PWD)/postgresql/migrations:/migrations --network=$(NETWORK) migrate/migrate -path=/migrations/ -database $(DSN) up
migrate-create:
docker run -v $(PWD)/postgresql/migrations:/migrations --network=$(NETWORK) migrate/migrate create -dir=/migrations/ -ext=.sql $(name)
migrate-down:
docker run -v $(PWD)/postgresql/migrations:/migrations --network=$(NETWORK) migrate/migrate -path=/migrations/ -database $(DSN) down 1
migrate-version:
docker run -v $(PWD)/postgresql/migrations:/migrations --network=$(NETWORK) migrate/migrate -path=/migrations/ -database $(DSN) version
migrate-fix:
docker run -v $(PWD)/postgresql/migrations:/migrations --network=$(NETWORK) migrate/migrate -path=/migrations/ -database $(DSN) force $(version)