-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (31 loc) · 944 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
HOST ?= 0.0.0.0
PORT ?= 8000
.PHONY: install
install:
@poetry install
@poetry run alembic upgrade head
.PHONY: check_migrations
check_migrations:
@echo "Checking if there are any unapplied migrations..."
@if ! command_output=$$(poetry run alembic current | tail -n 1); then \
echo "ERROR: Command failed"; \
exit 1; \
fi; \
if ! echo $$command_output | grep -q "head"; then \
echo "ALERT: There are unapplied migrations! Please run: 'make migrate'"; \
exit 0; \
fi; \
echo "SUCCESS: No migrations to run. DB up to date!"
.PHONY: migrate
migrate:
@poetry run alembic upgrade head
.PHONY: reset-db
reset-db:
@poetry run alembic downgrade base
# USAGE: make makemigrations MSG="migration name"
.PHONY: create_migration
create_migration:
@poetry run alembic revision --autogenerate -m "$(MSG)"
.PHONY: run_server
run_server:
@uvicorn how2meet.main:app --reload --log-level info --port ${PORT} --host ${HOST}