career_app / backend /Makefile
Youngger9765
refactor: reorganize project structure and add new features
e66ee1b
.PHONY: help test test-unit test-integration test-e2e test-cov migrate-init migrate-create migrate-up migrate-down migrate-history migrate-current
help:
@echo "Available Commands:"
@echo ""
@echo "Testing Commands:"
@echo " make test - Run all tests"
@echo " make test-unit - Run unit tests only"
@echo " make test-integration - Run integration tests only"
@echo " make test-e2e - Run end-to-end tests only"
@echo " make test-cov - Run tests with coverage report"
@echo ""
@echo "Database Migration Commands:"
@echo " make migrate-init - Initialize alembic (already done)"
@echo " make migrate-create name=<name> - Create a new migration"
@echo " make migrate-up - Apply all pending migrations"
@echo " make migrate-down - Rollback one migration"
@echo " make migrate-history - Show migration history"
@echo " make migrate-current - Show current migration version"
@echo " make migrate-auto msg=<message> - Auto-generate migration from models"
# Testing commands
test:
cd .. && python -m pytest backend/tests -v
test-unit:
cd .. && python -m pytest backend/tests/unit -v
test-integration:
cd .. && python -m pytest backend/tests/integration -v
test-e2e:
cd .. && python -m pytest backend/tests/e2e -v
test-cov:
cd .. && python -m pytest backend/tests --cov=backend --cov-report=html --cov-report=term
# Initialize alembic (already done, kept for reference)
migrate-init:
alembic init alembic
# Create a new migration
migrate-create:
@if [ -z "$(name)" ]; then \
echo "Error: Please provide a migration name. Usage: make migrate-create name=your_migration_name"; \
exit 1; \
fi
alembic -c alembic.ini revision -m "$(name)"
# Auto-generate migration from model changes
migrate-auto:
@if [ -z "$(msg)" ]; then \
echo "Error: Please provide a message. Usage: make migrate-auto msg='your message'"; \
exit 1; \
fi
alembic -c alembic.ini revision --autogenerate -m "$(msg)"
# Apply all pending migrations
migrate-up:
alembic -c alembic.ini upgrade head
# Rollback one migration
migrate-down:
alembic -c alembic.ini downgrade -1
# Show migration history
migrate-history:
alembic -c alembic.ini history
# Show current migration version
migrate-current:
alembic -c alembic.ini current
# Apply migrations to a specific version
migrate-to:
@if [ -z "$(version)" ]; then \
echo "Error: Please provide a version. Usage: make migrate-to version=<revision>"; \
exit 1; \
fi
alembic -c alembic.ini upgrade $(version)
# Generate SQL for migrations (dry run)
migrate-sql:
alembic -c alembic.ini upgrade head --sql
# Check if migrations are up to date
migrate-check:
alembic -c alembic.ini check