You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ci): add GitHub Actions workflows for CI, production, and test PyPI publishing with uv integration and update .gitignore and docs for development environment
`django-dbml` is a Django app that converts the metadata exposed by Django models into DBML. The main entrypoint is the `dbml` management command.
6
+
7
+
## How the generator is organized
8
+
9
+
`django_dbml/management/commands/dbml.py` is responsible for:
10
+
11
+
1. Selecting which models should be part of the schema.
12
+
2. Expanding the selection to include forward-related models.
13
+
3. Mapping Django field classes to DBML field types.
14
+
4. Rendering tables, enums, indexes, notes, and references.
15
+
16
+
`django_dbml/utils.py` contains the field-name normalization helper used during type mapping.
17
+
18
+
## Local development workflow
19
+
20
+
Install dependencies:
21
+
22
+
```bash
23
+
uv sync --locked
24
+
```
25
+
26
+
Run the full test suite:
27
+
28
+
```bash
29
+
uv run pytest
30
+
```
31
+
32
+
Run linting:
33
+
34
+
```bash
35
+
uv run ruff check .
36
+
```
37
+
38
+
Build artifacts locally:
39
+
40
+
```bash
41
+
uv build
42
+
```
43
+
44
+
If `uv` cannot write to the default cache directory in your environment, use:
45
+
46
+
```bash
47
+
UV_CACHE_DIR=.uv-cache uv sync --locked
48
+
UV_CACHE_DIR=.uv-cache uv run pytest
49
+
```
50
+
51
+
If you update dependencies, refresh the lockfile before syncing again:
52
+
53
+
```bash
54
+
uv lock
55
+
uv sync
56
+
```
57
+
58
+
## How to extend the command safely
59
+
60
+
When adding support for a new Django field or DBML feature:
61
+
62
+
1. Update the rendering logic in `django_dbml/management/commands/dbml.py`.
63
+
2. Add or adjust models inside `tests/testapp/models.py` to cover the new metadata shape.
64
+
3. Add assertions in `tests/test_command.py` for the rendered DBML.
65
+
4. If the change is isolated to a helper, add a focused unit test in `tests/test_utils.py`.
66
+
67
+
Prefer command-level tests for behavior that depends on Django model metadata, because the package's value is in the final DBML output rather than in isolated internal methods.
0 commit comments