-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (35 loc) · 1.09 KB
/
Makefile
File metadata and controls
44 lines (35 loc) · 1.09 KB
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
# Aegis Memory - Database Management
#
# Usage:
# make db-upgrade - Apply all pending migrations
# make db-downgrade - Revert last migration
# make db-migrate MSG="description" - Generate new migration
# make db-check - Verify migration round-trip (upgrade + downgrade + upgrade)
# make db-current - Show current migration revision
# make db-history - Show migration history
# make test - Run all tests
# make lint - Run linter
.PHONY: db-upgrade db-downgrade db-migrate db-check db-current db-history test lint
db-upgrade:
alembic upgrade head
db-downgrade:
alembic downgrade -1
db-migrate:
alembic revision --autogenerate -m "$(MSG)"
db-check:
@echo "=== Migration round-trip check ==="
@echo "Step 1: Upgrade to head..."
alembic upgrade head
@echo "Step 2: Downgrade to base..."
alembic downgrade base
@echo "Step 3: Upgrade to head again..."
alembic upgrade head
@echo "=== Round-trip check passed ==="
db-current:
alembic current
db-history:
alembic history --verbose
test:
pytest tests/ -v
lint:
ruff check server/ tests/