Skip to main content

Module author

Module author 

Source
Expand description

Canonical migration authoring core (#166).

Owns the single SchemaDiff -> ordered operations mapping shared by the live makemigrations flow and the offline authoring API. Everything here is pure: no database connection, no filesystem access, no clock reads.

Structs§

AuthorMigrationRequest
A complete offline authoring request.
AuthoredArtifact
One in-memory artifact file, path relative to the migrations directory.
AuthoredMigration
The complete authored artifact set for one migration.
MigrationMetadata
Identity and dependency metadata for one authored migration.
PositionedOperations
Explicit portable operations placed around the schema change set.
PythonRenderRequest
Everything needed to render one migration .py.
RenderedSnapshot
One rendered snapshot: file contents keyed by path relative to the migrations directory (e.g. snapshots/v0003/entities.py).
SnapshotContext
Snapshot/version context for one authored migration.
SnapshotRenderRequest
Inputs for rendering one snapshot version.

Enums§

ExistingArtifactPolicy
How to treat artifact paths that already exist on disk.

Functions§

author_migration
Author the complete artifact set for one migration, in memory.
map_schema_diff
Map a computed [SchemaDiff] into the ordered authoring operation list.
migration_class_name
Convert a migration name suffix into its class name (add_company -> AddCompanyMigration).
py_repr
Render a Python string literal exactly like CPython’s repr().
render_migration_python
Render the complete migration .py source.
render_snapshot
Render the complete snapshot file set in memory.
write_authored_migration
Write every artifact of authored under migrations_dir.