-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathjustfile
More file actions
68 lines (51 loc) · 1.53 KB
/
justfile
File metadata and controls
68 lines (51 loc) · 1.53 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
default:
just --list
up:
docker-compose up -d
kill:
docker-compose kill
build:
docker-compose build
ps:
docker-compose ps
exec *args:
docker-compose exec app {{args}}
logs *args:
docker-compose logs {{args}} -f
ruff *args:
docker compose exec app ruff check {{args}} src
docker compose exec app ruff format src
lint:
just ruff --fix
backup:
docker compose exec app_db scripts/backup
# examples:
# "just get-backup dump_name_2021-01-01..backup.gz" to copy particular backup
# "just get-backup" to copy directory (backups) with all dumps
mount-docker-backup *args:
docker cp app_db:/backups/{{args}} ./{{args}}
restore *args:
docker compose exec app_db scripts/restore {{args}}
test *args:
docker compose exec app pytest {{args}}
# Run pytest with this repo's venv (avoids wrong interpreter from another project)
# Windows: just test-local | Unix: ./.venv/bin/python -m pytest tests/ -v
test-local *args:
.\.venv\Scripts\python.exe -m pytest {{args}}
# Database migration commands
# Usage: just db-migrate [cmd] [args]
# Examples:
# just db-migrate create "add user table"
# just db-migrate upgrade head
# just db-migrate downgrade -1
db-migrate *args:
docker compose exec app scripts/db-migrate.sh {{args}}
# Generate a migration without autogenerate
db-create *args:
docker compose exec app alembic revision -m "{{args}}"
# Apply all migrations
db-upgrade:
docker compose exec app alembic upgrade head
# Show current migration version
db-current:
docker compose exec app alembic current