django-compose 0.1.0.dev3__tar.gz → 0.1.0.dev6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/CHANGELOG.md +21 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/PKG-INFO +1 -1
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/README.md +1 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/SPEC.md +46 -11
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/dependencies.md +1 -1
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/migrations.md +65 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/packaging.md +4 -4
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/pyproject.toml +1 -1
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/scripts/check_distribution.py +34 -10
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/components.py +11 -3
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/__init__.py +1 -1
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/makemigrations.py +104 -4
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/migrations.py +101 -27
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/serving.py +1 -1
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/snapshot.py +16 -9
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/sources.py +20 -12
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_components.py +71 -0
- django_compose-0.1.0.dev6/tests/test_initial_history.py +752 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_launcher.py +24 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_migration_imports.py +20 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_migrations.py +26 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_migrations_guards.py +60 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_snapshot.py +97 -1
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_sources.py +33 -3
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/uv.lock +1 -1
- django_compose-0.1.0.dev3/tests/test_initial_history.py +0 -171
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/.gitignore +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/AGENTS.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/CONTRIBUTING.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/COPYING +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/LICENSE +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/Makefile +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/NOTICE +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/README.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/ROADMAP.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/components.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/configuration.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/extensions.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/models.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/proposals/0001-native-url-collisions.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/proposals/0002-supplied-distribution-metadata.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/proposals/README.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/provisioning.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/docs/quickstart.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/.gitignore +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/README.md +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/__init__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/apps.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/autoconfig.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/integrations.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/management/__init__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/management/commands/verify_context.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/models.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/pyproject.toml +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/schema.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/transport.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/catalog/urls.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/contexts.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/manage.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/reviews/__init__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/reviews/apps.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/reviews/autoconfig.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/reviews/models.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/reviews/pyproject.toml +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/settings.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/urls.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/examples/shop/verify.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/__init__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/__main__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/apps.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/artifacts.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/asgi.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/autoreload.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/build.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/checks.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/cli.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/conf.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/declarations.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/history.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/__init__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/check_migrations.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/compose.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/migrate.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/provision.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/reset_migration_history.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/commands/retire_history.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/migration_imports.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/model_composition.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/models.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/provision.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/py.typed +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/rendering.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/typing.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/urls.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/core_fixtures/__init__.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_artifacts.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_asgi.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_autoreload.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_bootstrap.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_boundaries.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_command_context.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_conf.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_history.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_integrations.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_migration_scaffold.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_migrations_postgres.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_models.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_provision.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_provision_postgres.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_startup.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_typing.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/test_urls.py +0 -0
- {django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/tests/typing_fixtures/__init__.py +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0.dev6
|
|
4
|
+
|
|
5
|
+
- Allow transition owners to declare an adoption-safe initial baseline through
|
|
6
|
+
`initial_baseline: "satisfied"`, preserving true-guard data work and immutable
|
|
7
|
+
source hashes. Roll back initial schema, bindings and reconciliation together
|
|
8
|
+
when migration authoring raises.
|
|
9
|
+
- Expose the existing transition discovery owner as `discover_transitions` so
|
|
10
|
+
settings adapters can annotate addon-owned records without copying discovery.
|
|
11
|
+
|
|
12
|
+
## 0.1.0.dev5
|
|
13
|
+
|
|
14
|
+
- Respect Django's swapped-model storage semantics when guarding migrations, so
|
|
15
|
+
projects with a custom user model can create migrations and provision normally.
|
|
16
|
+
|
|
17
|
+
## 0.1.0.dev4 — not published
|
|
18
|
+
|
|
19
|
+
The immutable tag is retained; these changes are included in dev5.
|
|
20
|
+
|
|
21
|
+
- Avoid distribution ownership scans for module-path lookups and reuse each exact
|
|
22
|
+
native app configuration within one dependency selection.
|
|
23
|
+
|
|
3
24
|
## 0.1.0.dev3
|
|
4
25
|
|
|
5
26
|
- Reorganize documentation around the project workflow, public APIs and app hooks,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: django-compose
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev6
|
|
4
4
|
Summary: Compose reusable Django apps into a runnable project.
|
|
5
5
|
Project-URL: Source, https://github.com/ang-ee/django-compose
|
|
6
6
|
Project-URL: Documentation, https://github.com/ang-ee/django-compose/tree/main/docs
|
|
@@ -52,6 +52,7 @@ validation and lifecycle rules live in the [API reference](SPEC.md).
|
|
|
52
52
|
| `components.index_components(distributions, *, group)` | Apply the same indexing rules to supplied native `Distribution` objects |
|
|
53
53
|
| `components.active_requirements(requirements)` | Return native `Requirement` values active on this platform with `extra=""` |
|
|
54
54
|
| `conf.apply_app_settings(namespace, closure)` | Apply app settings to a project using ordinary authored concrete models |
|
|
55
|
+
| `snapshot.discover_transitions(entries)` | Read default transition records from resolved app identities for an integration to annotate without importing migration code |
|
|
55
56
|
| `provision.require_provisioned(using="default", timeout=0)` | Require recorded database readiness for the verified build |
|
|
56
57
|
| `serving.artifact_path(relative)` | Locate and verify a generated artifact |
|
|
57
58
|
| `serving.receipt_lease()` / `verified_receipt()` | Hold a shared build-record lease / read the startup-verified record |
|
|
@@ -106,6 +106,7 @@ root app names, and `required: frozenset[str]` of dependency-only app names.
|
|
|
106
106
|
`components: Mapping[str, str]` maps selected canonical distribution names to
|
|
107
107
|
their native app names. `dependencies` maps selected native app names to ordered
|
|
108
108
|
direct dependency app names. These mappings are immutable.
|
|
109
|
+
Each exact app/config entry is resolved once per call; later calls resolve afresh.
|
|
109
110
|
|
|
110
111
|
Each participating distribution declares exactly one group entry point, keyed
|
|
111
112
|
by native `AppConfig.name`, whose value is a native app/config string. Active
|
|
@@ -275,19 +276,33 @@ the namespace. Deployment secrets are excluded unless deliberately named.
|
|
|
275
276
|
Default exclusions can be replaced and prune the default Python walk. Explicit
|
|
276
277
|
extra globs include matching files even beneath excluded directories. Other
|
|
277
278
|
subdirectories, including any directory named `web`, are ordinary source inputs.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
`SourceResolver` locates modules through native path finders over selected app
|
|
280
|
+
directories and then `sys.path`, without executing parent packages. Path-only
|
|
281
|
+
lookups for fingerprints, serving and reload inputs do not inspect distribution
|
|
282
|
+
metadata. Migration import audits additionally determine providers through exact
|
|
283
|
+
RECORD or PEP 610 ownership, with one lazy index per audit. Native app/config
|
|
284
|
+
modules are imported to select configurations and must remain safe before Django
|
|
285
|
+
setup. Snapshot and serving do not import the model compiler or execute integrations.
|
|
284
286
|
|
|
285
287
|
Without `COMPOSE_TRANSITION_SOURCE`, each selected app contributes sorted
|
|
286
288
|
`compose_migrations/<label>/<name>.py` files in app order, including numeric
|
|
287
|
-
migration names.
|
|
288
|
-
`
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
migration names. The public owner is
|
|
290
|
+
`snapshot.discover_transitions(entries: Iterable[Entry]) -> tuple[Mapping[str, str], ...]`.
|
|
291
|
+
It accepts resolved identities such as `Closure.app_entries`, preserves their
|
|
292
|
+
order, reports watched paths and returns immutable normalized records without
|
|
293
|
+
importing apps or migration modules. Default snapshot discovery calls this same
|
|
294
|
+
function. A settings adapter can use the already resolved `COMPOSE_CLOSURE` during
|
|
295
|
+
an app's `settings(namespace)` callback, annotate copies using owner-declared
|
|
296
|
+
facts, and return concrete `COMPOSE_TRANSITION_SOURCE` records before the snapshot.
|
|
297
|
+
Preserve other records and any explicitly authored replacement source; selecting
|
|
298
|
+
apps again or reading lazy Django settings during configuration is unnecessary.
|
|
299
|
+
An explicit source replaces discovery. Records require
|
|
300
|
+
`declaring_app`, `name`, `app_label` and `module` string keys, and optionally
|
|
301
|
+
`initial_baseline: "satisfied"`; other keys or baseline values are invalid.
|
|
302
|
+
Omission retains strict guard handling. The explicit transition-owner provider
|
|
303
|
+
supplies this assertion; default discovery does not infer it from source modules.
|
|
304
|
+
Modules relative to the declaring app are normalized once. Duplicate
|
|
305
|
+
`<declaring_app>:<name>` origins fail. `Snapshot.transition_records` retains the frozen normalized records;
|
|
291
306
|
`Snapshot.transitions` stores their origin/sha256 pairs. Build and native history
|
|
292
307
|
use the same records.
|
|
293
308
|
|
|
@@ -464,11 +479,31 @@ expansion. Initial `--check` retains Django's exit status 1 for missing history;
|
|
|
464
479
|
are refused before initial schema authoring. If native expansion requires changes
|
|
465
480
|
to an app with existing history, the command refuses before writes and asks the
|
|
466
481
|
caller to author that app's transitions first; existing history bytes remain intact.
|
|
482
|
+
Initial authoring, binding and final reconciliation share an exception rollback
|
|
483
|
+
boundary: restore affected pre-call migration bytes and permissions, remove exact
|
|
484
|
+
newly authored files and invalidate migration imports, without recorder writes.
|
|
485
|
+
A failed attempt can retry from the same disk history. This is exception safety,
|
|
486
|
+
not crash-atomic publication of multiple files.
|
|
467
487
|
|
|
468
488
|
`TransitionBinding` uses frozen snapshot records by default, or explicit
|
|
469
489
|
`declarations=`. It binds native migration origins `<declaring_app>:<name>` to
|
|
470
490
|
the project's actual graph leaves. Each source provides a native `Migration`
|
|
471
|
-
and a pure `applies(ProjectState) -> bool` guard
|
|
491
|
+
and a pure `applies(ProjectState) -> bool` guard. A pending false guard is refused
|
|
492
|
+
unless its owner declares `initial_baseline: "satisfied"` and the label acquired
|
|
493
|
+
its first native disk nodes in this successful command's initial-authoring phase,
|
|
494
|
+
including native prerequisite expansion. The assertion means the final-schema
|
|
495
|
+
initial baseline satisfies this transition on every database adopting it,
|
|
496
|
+
including existing rows adopted through native `migrate --fake-initial`. It does
|
|
497
|
+
not assert that the original operations executed. Existing initial-looking
|
|
498
|
+
files, reset-created initials and global read-only checks supply no exemption.
|
|
499
|
+
True guards always retain their operations, including bootstrap and backfill
|
|
500
|
+
work. A false-guard baseline binding substitutes Django's native empty migration
|
|
501
|
+
before downstream graph state calculation. Its materialization footer seals a
|
|
502
|
+
native zero-operation Migration subclass and `compose_initial_baseline =
|
|
503
|
+
"satisfied"`, omitting any source-class state or database lifecycle overrides. This
|
|
504
|
+
durable origin must be retained like any other native history node after its
|
|
505
|
+
source declaration is removed. Its source bytes and source SHA remain unchanged;
|
|
506
|
+
adding the optional declaration does not rewrite or invalidate existing origins.
|
|
472
507
|
Immutable source/body digests, dependencies, `run_before`, `replaces` and complete
|
|
473
508
|
squash chains are preserved. Materialized history remains executable after its
|
|
474
509
|
source declaration is removed. Changed immutable sources, duplicate origins,
|
|
@@ -50,7 +50,7 @@ The `typing` extra is unnecessary for building or running a project. Install it
|
|
|
50
50
|
in the project's environment when you want composed-model analysis:
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
|
-
python -m pip install 'django-compose[typing]==0.1.0.
|
|
53
|
+
python -m pip install 'django-compose[typing]==0.1.0.dev6'
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
The extra installs published Angee forks of mypy and django-stubs, keeping their
|
|
@@ -156,6 +156,71 @@ helpers still need their providers. A guard that sees a final schema cannot prov
|
|
|
156
156
|
that a data operation already ran. Native dependencies, replacements and complete
|
|
157
157
|
squash chains retain that execution history.
|
|
158
158
|
|
|
159
|
+
A transition owner can explicitly assert that a final-schema initial baseline
|
|
160
|
+
satisfies a transition by adding `initial_baseline: "satisfied"` to its existing
|
|
161
|
+
explicit declaration provider, without editing its immutable migration source:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
# inventory/transitions.py; safe to call before Django setup.
|
|
165
|
+
def declarations():
|
|
166
|
+
return [{
|
|
167
|
+
"declaring_app": "inventory",
|
|
168
|
+
"name": "rename_legacy",
|
|
169
|
+
"app_label": "inventory",
|
|
170
|
+
"module": "inventory.compose_migrations.inventory.rename_legacy",
|
|
171
|
+
"initial_baseline": "satisfied",
|
|
172
|
+
}]
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Wire that provider through `COMPOSE_TRANSITION_SOURCE =
|
|
176
|
+
"inventory.transitions.declarations"`. The explicit provider replaces default
|
|
177
|
+
filename discovery, so include every required transition record. Omission is
|
|
178
|
+
strict; no other baseline value is accepted. The frozen declaration participates
|
|
179
|
+
in the snapshot digest while migration source bytes and hashes stay unchanged.
|
|
180
|
+
|
|
181
|
+
Integrations that annotate discovered transitions can reuse the public discovery
|
|
182
|
+
owner instead of maintaining another list or directory scanner:
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
# Inside an integration's autoconfig.settings(namespace) callback:
|
|
186
|
+
from django_compose.snapshot import discover_transitions
|
|
187
|
+
|
|
188
|
+
records = discover_transitions(namespace["COMPOSE_CLOSURE"].app_entries)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
One shared adapter can consult each selected app's own declarations, copy the
|
|
192
|
+
matching records with `dict(record, initial_baseline="satisfied")`, and return
|
|
193
|
+
the resulting ordered sequence as `COMPOSE_TRANSITION_SOURCE`. Keep all other
|
|
194
|
+
records unchanged and respect any explicit project-authored replacement. The
|
|
195
|
+
snapshot then freezes the result; no migration module is imported by discovery.
|
|
196
|
+
The package defines no extra addon metadata format for these policy facts.
|
|
197
|
+
|
|
198
|
+
This is a strong assertion: no original operation is needed on **any** database
|
|
199
|
+
adopting the final-schema baseline, including existing tables and rows adopted
|
|
200
|
+
with native `migrate --fake-initial`. If those rows need conversion or backfill,
|
|
201
|
+
keep that work in a separate native transition whose guard is true on the final
|
|
202
|
+
schema and whose operations handle both empty and preexisting tables. True guards
|
|
203
|
+
always run their original operations, even when the declaration has this option.
|
|
204
|
+
|
|
205
|
+
Only a declared false guard targeting a label actually initialized by this
|
|
206
|
+
command's native initial-authoring phase becomes a sealed zero-operation origin.
|
|
207
|
+
Native prerequisite expansion contributes its exact newly initialized labels.
|
|
208
|
+
Existing initial-looking files do not qualify, and ordinary planning/checks and
|
|
209
|
+
history reset stay strict. The sealed `compose_initial_baseline = "satisfied"`
|
|
210
|
+
metadata identifies satisfaction by the baseline, rather than execution of the
|
|
211
|
+
original operations. Planning and sealed history use a native empty migration,
|
|
212
|
+
so source-class state and database lifecycle overrides are omitted too. Keep that
|
|
213
|
+
native origin node after removing the declaration; it preserves source/body digests, imports and resolved graph edges and remains
|
|
214
|
+
executable without the original source module. Imported helpers still need their
|
|
215
|
+
providers.
|
|
216
|
+
|
|
217
|
+
If initial generation, binding or final reconciliation raises, authoring restores
|
|
218
|
+
affected pre-call migration bytes and permissions and removes its exact new
|
|
219
|
+
files. It invalidates migration imports and never writes the migration recorder;
|
|
220
|
+
a retry starts from the same disk history. This exception rollback does not
|
|
221
|
+
promise crash-atomic multi-file filesystem publication. Django owns subsequent
|
|
222
|
+
application and database retry behavior.
|
|
223
|
+
|
|
159
224
|
New bindings use `compose_*` metadata. Existing `angee_origin` and
|
|
160
225
|
`angee_source_sha256` metadata remain readable for historical compatibility;
|
|
161
226
|
there is no need to rewrite old migration files. Check and dry-run paths do not
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Installation and deployment
|
|
2
2
|
|
|
3
|
-
The current version is the development preview `0.1.0.
|
|
3
|
+
The current version is the development preview `0.1.0.dev6`, including component
|
|
4
4
|
selection, isolated inspection and native provisioning.
|
|
5
5
|
Python 3.14 is the verified environment. The declared constraints are Python
|
|
6
6
|
`>=3.14` and Django `>=6.1.2,<6.2`; see [dependencies](dependencies.md) and
|
|
@@ -9,10 +9,10 @@ Python 3.14 is the verified environment. The declared constraints are Python
|
|
|
9
9
|
## Install from PyPI
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
python -m pip install django-compose==0.1.0.
|
|
12
|
+
python -m pip install django-compose==0.1.0.dev6
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Use `django-compose[typing]==0.1.0.
|
|
15
|
+
Use `django-compose[typing]==0.1.0.dev6` for the optional composition plugin and
|
|
16
16
|
its published typing dependencies; see [advanced typing](dependencies.md#advanced-typing).
|
|
17
17
|
|
|
18
18
|
## Install locally
|
|
@@ -36,7 +36,7 @@ environment:
|
|
|
36
36
|
# In the django-compose checkout, with uv installed:
|
|
37
37
|
uv build --wheel
|
|
38
38
|
# In the project environment, using the actual archive path:
|
|
39
|
-
python -m pip install /path/to/django-compose/dist/django_compose-0.1.0.
|
|
39
|
+
python -m pip install /path/to/django-compose/dist/django_compose-0.1.0.dev6-py3-none-any.whl
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
The base installation includes Django, packaging and django-yamlconf. Optional extras are described in
|
|
@@ -119,6 +119,12 @@ def installed_components(
|
|
|
119
119
|
)
|
|
120
120
|
host = directory / "installed-host"
|
|
121
121
|
host.mkdir()
|
|
122
|
+
accounts = host / "accounts"
|
|
123
|
+
accounts.mkdir()
|
|
124
|
+
(accounts / "__init__.py").write_text("")
|
|
125
|
+
(accounts / "models.py").write_text(
|
|
126
|
+
"from django.contrib.auth.models import AbstractUser\nclass User(AbstractUser):\n pass\n"
|
|
127
|
+
)
|
|
122
128
|
settings = """from pathlib import Path
|
|
123
129
|
from django_compose.conf import configure
|
|
124
130
|
BASE_DIR = Path(__file__).parent
|
|
@@ -127,20 +133,23 @@ DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": BASE_DI
|
|
|
127
133
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
|
128
134
|
COMPOSE_OUTPUT_DIR = BASE_DIR / "runtime"
|
|
129
135
|
COMPOSE_OUTPUT_MODULE = "runtime"
|
|
130
|
-
INSTALLED_APPS = [
|
|
136
|
+
INSTALLED_APPS = [
|
|
137
|
+
"django.contrib.contenttypes", "django.contrib.auth", "accounts", "installed_reviews",
|
|
138
|
+
]
|
|
139
|
+
AUTH_USER_MODEL = "accounts.User"
|
|
140
|
+
COMPOSE_COMPONENT_GROUP = "compose.smoke"
|
|
131
141
|
configure(globals())
|
|
132
142
|
"""
|
|
133
|
-
settings = settings.replace(
|
|
134
|
-
'INSTALLED_APPS = ["catalog", "reviews"]',
|
|
135
|
-
'INSTALLED_APPS = ["installed_reviews"]\nCOMPOSE_COMPONENT_GROUP = "compose.smoke"',
|
|
136
|
-
)
|
|
137
143
|
(host / "settings.py").write_text(settings)
|
|
138
144
|
env = {**environment, "DJANGO_SETTINGS_MODULE": "settings"}
|
|
139
145
|
compiler = [str(python), "-m", "django_compose"]
|
|
140
146
|
run([*compiler, "compose"], cwd=host, env=env)
|
|
141
|
-
run([*compiler, "makemigrations", "installed_catalog", "--noinput"], cwd=host, env=env)
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
run([*compiler, "makemigrations", "accounts", "installed_catalog", "--noinput"], cwd=host, env=env)
|
|
148
|
+
for _ in range(2):
|
|
149
|
+
run([*compiler, "provision", "--wait-db", "0"], cwd=host, env=env)
|
|
150
|
+
run([*compiler, "provision", "--check", "--wait-db", "0"], cwd=host, env=env)
|
|
151
|
+
result = run([*compiler, "migrate", "--noinput"], cwd=host, env=env)
|
|
152
|
+
assert "No migrations to apply" in result, result
|
|
144
153
|
run([*compiler, "compose", "--check"], cwd=host, env=env)
|
|
145
154
|
run(
|
|
146
155
|
[
|
|
@@ -153,7 +162,11 @@ django.setup()
|
|
|
153
162
|
from django.apps import apps
|
|
154
163
|
from django.db.migrations.state import ProjectState
|
|
155
164
|
from django.conf import settings
|
|
156
|
-
|
|
165
|
+
from django.contrib.auth import get_user_model
|
|
166
|
+
from django.db import connection
|
|
167
|
+
assert settings.COMPOSE_ROOTS == (
|
|
168
|
+
"django.contrib.contenttypes", "django.contrib.auth", "accounts", "installed_reviews",
|
|
169
|
+
)
|
|
157
170
|
assert settings.COMPOSE_CLOSURE.components == {
|
|
158
171
|
"compose-smoke-catalog": "installed_catalog", "compose-smoke-reviews": "installed_reviews",
|
|
159
172
|
}
|
|
@@ -161,6 +174,7 @@ from django_compose.provision import require_provisioned
|
|
|
161
174
|
require_provisioned()
|
|
162
175
|
assert settings.SMOKE_CONTRIBUTORS == ["installed_catalog", "installed_reviews"]
|
|
163
176
|
assert tuple(entry.name for entry in settings.COMPOSE_SNAPSHOT.entries) == (
|
|
177
|
+
"django.contrib.contenttypes", "django.contrib.auth", "accounts",
|
|
164
178
|
"installed_catalog", "installed_reviews",
|
|
165
179
|
)
|
|
166
180
|
Item = apps.get_model("installed_catalog", "Item")
|
|
@@ -176,6 +190,16 @@ row = Child.objects.create(title="installed component", detail="child", rating=5
|
|
|
176
190
|
assert Item.objects.get(pk=row.pk).rating == 5
|
|
177
191
|
assert Child.objects.get(pk=row.pk).reviewed is True
|
|
178
192
|
state = ProjectState.from_apps(apps)
|
|
193
|
+
swapped = state.apps.get_model("auth", "User")
|
|
194
|
+
assert swapped._meta.swapped == "accounts.User"
|
|
195
|
+
assert all(field.remote_field.through is None for field in swapped._meta.local_many_to_many)
|
|
196
|
+
User = get_user_model()
|
|
197
|
+
assert User._meta.label == "accounts.User"
|
|
198
|
+
assert "auth_user" not in connection.introspection.table_names()
|
|
199
|
+
user = User.objects.create_user(username="installed-user")
|
|
200
|
+
group = apps.get_model("auth", "Group").objects.create(name="installed-group")
|
|
201
|
+
user.groups.add(group)
|
|
202
|
+
assert user.groups.get() == group
|
|
179
203
|
assert "installed_catalog.item" in state.models["installed_catalog", "child"].bases
|
|
180
204
|
assert set(state.apps.get_model("installed_catalog", "Grandchild")._meta.parents) == {
|
|
181
205
|
state.apps.get_model("installed_catalog", "Child"),
|
|
@@ -387,7 +411,7 @@ assert Item.objects.get(pk=item.pk).rating == 5
|
|
|
387
411
|
print(
|
|
388
412
|
"Wheel/sdist contents and fresh installed-host build, serve, ORM, "
|
|
389
413
|
"migration, provisioning, drift, cleanup, installed component closure, "
|
|
390
|
-
"MTI and import audit checks passed."
|
|
414
|
+
"custom-user provisioning, MTI and import audit checks passed."
|
|
391
415
|
)
|
|
392
416
|
|
|
393
417
|
|
|
@@ -240,12 +240,20 @@ def enabled_apps(roots: Iterable[str], *, group: str | None = None) -> Closure:
|
|
|
240
240
|
|
|
241
241
|
Root configs are preselected and override dependency/default config choices.
|
|
242
242
|
Conflicting dependency configs, duplicate native labels and cycles fail.
|
|
243
|
+
Each exact app/config string resolves to one native instance per call.
|
|
243
244
|
"""
|
|
244
245
|
installed = installed_components(group) if group is not None else None
|
|
245
246
|
root_entries = tuple(roots)
|
|
246
247
|
if any(not isinstance(entry, str) for entry in root_entries):
|
|
247
248
|
raise ImproperlyConfigured("Root INSTALLED_APPS entries must be native app strings")
|
|
248
|
-
|
|
249
|
+
resolved: dict[str, AppConfig] = {}
|
|
250
|
+
|
|
251
|
+
def resolve(entry: str) -> AppConfig:
|
|
252
|
+
if entry not in resolved:
|
|
253
|
+
resolved[entry] = AppConfig.create(entry)
|
|
254
|
+
return resolved[entry]
|
|
255
|
+
|
|
256
|
+
root_configs = tuple((entry, resolve(entry)) for entry in root_entries)
|
|
249
257
|
normalized_roots = app_entries(Entry.from_config(config, entry) for entry, config in root_configs)
|
|
250
258
|
root_names = tuple(entry.name for entry in normalized_roots)
|
|
251
259
|
root_set = frozenset(root_names)
|
|
@@ -256,7 +264,7 @@ def enabled_apps(roots: Iterable[str], *, group: str | None = None) -> Closure:
|
|
|
256
264
|
def component_entry(provider: str) -> str:
|
|
257
265
|
assert installed is not None
|
|
258
266
|
point = installed.entry_points[provider]
|
|
259
|
-
config =
|
|
267
|
+
config = resolve(point.value)
|
|
260
268
|
if config.name != point.name:
|
|
261
269
|
raise ImproperlyConfigured(
|
|
262
270
|
f"Entry point {point.name!r} from {provider!r} selects app {config.name!r}"
|
|
@@ -264,7 +272,7 @@ def enabled_apps(roots: Iterable[str], *, group: str | None = None) -> Closure:
|
|
|
264
272
|
return point.value
|
|
265
273
|
|
|
266
274
|
def choose(entry: str) -> str:
|
|
267
|
-
config =
|
|
275
|
+
config = resolve(entry)
|
|
268
276
|
previous = selected.get(config.name)
|
|
269
277
|
if previous is None:
|
|
270
278
|
selected[config.name] = (entry, config)
|
{django_compose-0.1.0.dev3 → django_compose-0.1.0.dev6}/src/django_compose/management/__init__.py
RENAMED
|
@@ -100,7 +100,7 @@ def _fallback_inputs() -> None:
|
|
|
100
100
|
from django_compose.sources import SourceResolver
|
|
101
101
|
|
|
102
102
|
try:
|
|
103
|
-
location = SourceResolver(
|
|
103
|
+
location = SourceResolver().locate(module)
|
|
104
104
|
if location.path is not None:
|
|
105
105
|
report_inputs(files=[location.path])
|
|
106
106
|
except ImportError, ImproperlyConfigured, ValueError:
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import importlib
|
|
6
|
+
import stat
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from typing import Any
|
|
8
9
|
|
|
@@ -16,15 +17,21 @@ from django.db.migrations.loader import MigrationLoader
|
|
|
16
17
|
from django.db.migrations.writer import MigrationWriter
|
|
17
18
|
from django.utils.module_loading import module_dir
|
|
18
19
|
|
|
20
|
+
from django_compose.artifacts import atomic_write
|
|
19
21
|
from django_compose.management import require_serving_mode
|
|
20
22
|
from django_compose.migrations import (
|
|
21
23
|
DropGuardAutodetector,
|
|
22
24
|
TransitionBinding,
|
|
25
|
+
_forget_history,
|
|
23
26
|
_metadata,
|
|
24
27
|
)
|
|
25
28
|
from django_compose.serving import read_receipt
|
|
26
29
|
|
|
27
30
|
|
|
31
|
+
def _file_state(path: Path) -> tuple[bytes, int] | None:
|
|
32
|
+
return (path.read_bytes(), stat.S_IMODE(path.stat().st_mode)) if path.exists() else None
|
|
33
|
+
|
|
34
|
+
|
|
28
35
|
def history_labels() -> tuple[str, ...]:
|
|
29
36
|
"""Read the compiler receipt without invoking composition."""
|
|
30
37
|
receipt = read_receipt(Path(settings.COMPOSE_OUTPUT_DIR))
|
|
@@ -39,7 +46,77 @@ class Command(NativeCommand):
|
|
|
39
46
|
autodetector = DropGuardAutodetector
|
|
40
47
|
_initial_history: frozenset[str] | None = None
|
|
41
48
|
|
|
49
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
50
|
+
super().__init__(*args, **kwargs)
|
|
51
|
+
self._originals: dict[Path, tuple[bytes, int] | None] = {}
|
|
52
|
+
self._bound_files: list[Path] = []
|
|
53
|
+
self._changed_labels: set[str] = set()
|
|
54
|
+
self._migration_packages: dict[str, Path] = {}
|
|
55
|
+
|
|
42
56
|
def handle(self, *app_labels: str, **options: Any) -> str | None:
|
|
57
|
+
self._originals.clear()
|
|
58
|
+
self._bound_files.clear()
|
|
59
|
+
self._changed_labels.clear()
|
|
60
|
+
self._migration_packages.clear()
|
|
61
|
+
try:
|
|
62
|
+
return self._author(*app_labels, **options)
|
|
63
|
+
except BaseException:
|
|
64
|
+
for path in self._bound_files:
|
|
65
|
+
path.unlink(missing_ok=True)
|
|
66
|
+
for path, original in self._originals.items():
|
|
67
|
+
if original is None:
|
|
68
|
+
path.unlink(missing_ok=True)
|
|
69
|
+
else:
|
|
70
|
+
content, mode = original
|
|
71
|
+
atomic_write(path, content, mode=mode)
|
|
72
|
+
_forget_history(self._changed_labels, packages=self._migration_packages)
|
|
73
|
+
raise
|
|
74
|
+
|
|
75
|
+
def _remember(self, path: Path) -> None:
|
|
76
|
+
path = path.resolve()
|
|
77
|
+
if path not in self._originals:
|
|
78
|
+
self._originals[path] = _file_state(path)
|
|
79
|
+
|
|
80
|
+
def _record_native_directory(self, writer: MigrationWriter, package: str) -> Path:
|
|
81
|
+
"""Observe package writes; Django alone chooses and creates the directory.
|
|
82
|
+
|
|
83
|
+
basedir has no write hook. Snapshot initializer candidates below every
|
|
84
|
+
native imported ancestor, including AppConfig.path's direct-submodule
|
|
85
|
+
case, then journal only files changed by the native call. Do not select
|
|
86
|
+
a destination from these candidates or substitute a source pathfinder.
|
|
87
|
+
"""
|
|
88
|
+
parts = package.split(".")
|
|
89
|
+
candidates: list[tuple[str, Path, list[str]]] = []
|
|
90
|
+
config = apps.get_app_config(writer.migration.app_label)
|
|
91
|
+
if package.rpartition(".")[0] == config.name:
|
|
92
|
+
candidates.append((config.name, Path(config.path), parts[-1:]))
|
|
93
|
+
for length in range(1, len(parts) + 1):
|
|
94
|
+
prefix = ".".join(parts[:length])
|
|
95
|
+
try:
|
|
96
|
+
directory = Path(module_dir(importlib.import_module(prefix)))
|
|
97
|
+
except ImportError, ValueError:
|
|
98
|
+
continue
|
|
99
|
+
candidates.append((prefix, directory, parts[length:]))
|
|
100
|
+
initializers: dict[Path, tuple[str, tuple[bytes, int] | None]] = {}
|
|
101
|
+
for prefix, directory, suffix in candidates:
|
|
102
|
+
for part in ("", *suffix):
|
|
103
|
+
if part:
|
|
104
|
+
prefix += "." + part
|
|
105
|
+
directory /= part
|
|
106
|
+
path = (directory / "__init__.py").resolve()
|
|
107
|
+
initializers.setdefault(path, (prefix, _file_state(path)))
|
|
108
|
+
try:
|
|
109
|
+
directory = Path(writer.basedir).resolve()
|
|
110
|
+
finally:
|
|
111
|
+
for path, (prefix, original) in initializers.items():
|
|
112
|
+
if _file_state(path) != original:
|
|
113
|
+
self._originals.setdefault(path, original)
|
|
114
|
+
self._migration_packages[prefix] = path.parent
|
|
115
|
+
importlib.invalidate_caches()
|
|
116
|
+
self._migration_packages[package] = directory
|
|
117
|
+
return directory
|
|
118
|
+
|
|
119
|
+
def _author(self, *app_labels: str, **options: Any) -> str | None:
|
|
43
120
|
require_serving_mode()
|
|
44
121
|
name = options.get("name")
|
|
45
122
|
if name and not name.isidentifier():
|
|
@@ -61,6 +138,7 @@ class Command(NativeCommand):
|
|
|
61
138
|
and any(apps.get_app_config(label).get_models())
|
|
62
139
|
}
|
|
63
140
|
selected = set(app_labels) if app_labels else None
|
|
141
|
+
new_labels = frozenset[str]()
|
|
64
142
|
if initial:
|
|
65
143
|
for flag in ("merge", "empty", "update"):
|
|
66
144
|
if options.get(flag):
|
|
@@ -72,10 +150,15 @@ class Command(NativeCommand):
|
|
|
72
150
|
self._initial_history = None
|
|
73
151
|
if options.get("dry_run") or options.get("check_changes"):
|
|
74
152
|
return None
|
|
153
|
+
# Native writer may have imported a missing initializer as a
|
|
154
|
+
# namespace before writing it (including a same-process retry).
|
|
155
|
+
_forget_history(self._changed_labels, packages=self._migration_packages)
|
|
156
|
+
# Only actual disk nodes created by this native initial phase prove
|
|
157
|
+
# first authoring, including native prerequisite expansion.
|
|
158
|
+
current = MigrationLoader(None, ignore_no_migrations=True)
|
|
159
|
+
new_labels = frozenset(label for label, _ in current.disk_migrations if label not in initialized)
|
|
75
160
|
if selected is not None:
|
|
76
|
-
|
|
77
|
-
current = MigrationLoader(None, ignore_no_migrations=True)
|
|
78
|
-
selected.update(label for label, _ in current.disk_migrations if label not in initialized)
|
|
161
|
+
selected.update(new_labels)
|
|
79
162
|
if options.get("merge"):
|
|
80
163
|
return super().handle(*app_labels, **options)
|
|
81
164
|
authored = TransitionBinding(labels=labels)
|
|
@@ -83,7 +166,17 @@ class Command(NativeCommand):
|
|
|
83
166
|
if options.get("dry_run") or options.get("check_changes"):
|
|
84
167
|
authored.check(app_labels=selected)
|
|
85
168
|
else:
|
|
86
|
-
authored.materialize(
|
|
169
|
+
authored.materialize(
|
|
170
|
+
apps,
|
|
171
|
+
app_labels=selected,
|
|
172
|
+
initial_baselines=new_labels,
|
|
173
|
+
written_files=self._bound_files,
|
|
174
|
+
)
|
|
175
|
+
self._changed_labels.update(
|
|
176
|
+
declaration["app_label"]
|
|
177
|
+
for declaration in authored.declarations
|
|
178
|
+
if MigrationLoader.migrations_module(declaration["app_label"])[0] is not None
|
|
179
|
+
)
|
|
87
180
|
except (RuntimeError, ImproperlyConfigured) as error:
|
|
88
181
|
raise CommandError(str(error)) from error
|
|
89
182
|
return super().handle(*app_labels, **options)
|
|
@@ -113,6 +206,13 @@ class Command(NativeCommand):
|
|
|
113
206
|
if package is None:
|
|
114
207
|
raise CommandError(f"Migrations are disabled for app {label!r}")
|
|
115
208
|
writer = MigrationWriter(migration, self.include_header)
|
|
209
|
+
if not self.dry_run:
|
|
210
|
+
directory = self._record_native_directory(writer, package)
|
|
211
|
+
self._changed_labels.add(label)
|
|
212
|
+
self._remember(directory / writer.filename)
|
|
213
|
+
self._remember(directory / "__init__.py")
|
|
214
|
+
if update_previous_migration_paths:
|
|
215
|
+
self._remember(Path(update_previous_migration_paths[label]))
|
|
116
216
|
key = package, writer.filename
|
|
117
217
|
if key in destinations:
|
|
118
218
|
raise CommandError(f"Multiple migrations target {key!r}")
|