mafw.db.migration
Versioned database schema migration package.
This package implements the single internal migration service (the
MigrationManager) that compares the live
database against the complete set of discovered MAFwBaseModel
subclasses, reports differences, generates reviewable Python migration scripts,
tracks a per-database applied-migration history, and applies previously reviewed
pending scripts on explicit request.
Two front ends share this one implementation:
the
mafw dbCLI command group (diff,migrate generate,migrate status,migrate upandmigrate baseline), andthe opt-in
SchemaMigratorprocessor that runs afterTableCreatorand, by default, generates one migration and deliberately stops the pipeline.
Automatic schema migration is limited to MAFwBaseModel
subclasses registered in the global model register
(mafw_model_register). Models outside the register are
out of scope for automatic diffing and generation.
The public objects live in the focused submodules of this package (for example
mafw.db.migration.service, mafw.db.migration.diff and
mafw.db.migration.errors). Import them from their submodule so each object
has a single canonical documentation target.
Added in version 2.4.
- author:
Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
Modules
Per-backend adaptation and the migration applier. |
|
CLI support for migration service connections. |
|
Schema differ comparing discovered models with the live database. |
|
Migration-directory resolution and exclusive locking. |
|
Model discovery for the migration service. |
|
Migration-specific exception hierarchy. |
|
Per-database migration history. |
|
Structured result returned by every migration-service operation. |
|
Runtime helpers used by generated migration scripts. |
|
Migration-script representation, naming, rendering and safe writing. |
|
The single internal migration service. |