From 2032aeee0b8ded3da109264e377452613032bf8b Mon Sep 17 00:00:00 2001 From: dextmorgn Date: Sat, 14 Feb 2026 15:32:29 +0100 Subject: [PATCH] feat: update makefile with new commands --- Makefile | 62 ++++++++++++++++++++++++-------------------------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index ca87ca58..01891755 100644 --- a/Makefile +++ b/Makefile @@ -10,16 +10,14 @@ COMPOSE_DEPLOY := docker compose -f docker-compose.deploy.yml up-dev up-prod up-deploy down \ infra-dev infra-prod infra-stop-dev infra-stop-prod \ migrate-dev migrate-prod \ + alembic-upgrade alembic-downgrade alembic-revision \ api frontend celery \ test install clean check-env open-browser-dev open-browser-prod \ - logs-dev logs-prod logs-deploy status + logs-dev logs-prod logs-deploy status \ + regenerate-router ENV_DIRS := . flowsint-api flowsint-core flowsint-app -# ============================================================================= -# Environment Setup -# ============================================================================= - check-env: @echo "Checking .env files..." @for dir in $(ENV_DIRS); do \ @@ -31,10 +29,6 @@ check-env: fi; \ done -# ============================================================================= -# Development -# ============================================================================= - dev: @echo "Starting DEV environment..." $(MAKE) check-env @@ -68,10 +62,6 @@ open-browser-dev: xdg-open http://localhost:5173 2>/dev/null || \ echo "Frontend ready at http://localhost:5173" -# ============================================================================= -# Production -# ============================================================================= - prod: @echo "Starting PROD environment..." $(MAKE) check-env @@ -107,10 +97,6 @@ open-browser-prod: xdg-open http://localhost 2>/dev/null || \ echo "Frontend ready at http://localhost" -# ============================================================================= -# Deploy (GHCR images) -# ============================================================================= - deploy: @echo "Starting DEPLOY environment (GHCR images)..." $(MAKE) check-env @@ -127,10 +113,6 @@ up-deploy: logs-deploy: $(COMPOSE_DEPLOY) logs -f -# ============================================================================= -# Migrations -# ============================================================================= - migrate-dev: @echo "Running DEV migrations..." @if ! $(COMPOSE_DEV) ps -q neo4j | grep -q .; then \ @@ -148,9 +130,20 @@ migrate-prod: fi yarn migrate -# ============================================================================= -# Local Development (without Docker) -# ============================================================================= +alembic-upgrade: + @echo "Running Alembic migrations (upgrade head)..." + cd $(PROJECT_ROOT)/flowsint-api && poetry run alembic upgrade head + +alembic-downgrade: + @echo "Rolling back last Alembic migration..." + cd $(PROJECT_ROOT)/flowsint-api && poetry run alembic downgrade -1 + +alembic-revision: + @if [ -z "$(m)" ]; then \ + echo "Usage: make alembic-revision m=\"your migration message\""; exit 1; \ + fi + @echo "Creating new Alembic migration: $(m)" + cd $(PROJECT_ROOT)/flowsint-api && poetry run alembic revision --autogenerate -m "$(m)" api: cd $(PROJECT_ROOT)/flowsint-api && \ @@ -164,10 +157,6 @@ celery: poetry run celery -A flowsint_core.core.celery \ worker --loglevel=info --pool=threads --concurrency=10 -# ============================================================================= -# Testing & Installation -# ============================================================================= - test: cd flowsint-types && poetry run pytest cd flowsint-core && poetry run pytest @@ -181,10 +170,6 @@ install: cd flowsint-enrichers && poetry install cd flowsint-api && poetry install && poetry run alembic upgrade head -# ============================================================================= -# Utilities -# ============================================================================= - status: @echo "=== DEV Containers ===" @$(COMPOSE_DEV) ps 2>/dev/null || echo "No DEV containers" @@ -209,9 +194,9 @@ clean: rm -rf flowsint-enrichers/.venv rm -rf flowsint-api/.venv -# ============================================================================= -# Help -# ============================================================================= +regenerate-router: + @echo "Regenerating flowsint-app/src/routeTree.gen.ts" + cd $(PROJECT_ROOT)/flowsint-app && npx tsr generate help: @echo "Flowsint Makefile" @@ -239,6 +224,13 @@ help: @echo " make frontend - Run frontend locally" @echo " make celery - Run Celery worker locally" @echo "" + @echo "Migrations:" + @echo " make migrate-dev - Run Neo4j DEV migrations" + @echo " make migrate-prod - Run Neo4j PROD migrations" + @echo " make alembic-upgrade - Run Alembic migrations (upgrade head)" + @echo " make alembic-downgrade - Rollback last Alembic migration" + @echo " make alembic-revision m=.. - Create new Alembic migration" + @echo "" @echo "Utilities:" @echo " make status - Show container status" @echo " make down - Stop all containers"