directory.migration
Classes
Takes a directory and the structure/configuration it should have in |
|
Contains methods to migrate fields from one type to another. |
|
Tries to detect structural changes between two formcode blocks. |
Module Contents
- class directory.migration.DirectoryMigration(directory: onegov.directory.models.Directory, new_structure: str | None = None, new_configuration: DirectoryConfiguration | None = None, old_structure: str | None = None)[source]
Takes a directory and the structure/configuration it should have in the future.
It then migrates the existing directory entries, if possible.
- property entries: Iterable[DirectoryEntry][source]
- execute() None [source]
To run the migration, run this method. The other methods below should only be used if you know what you are doing.
- migrate_entry(entry: onegov.directory.models.directory_entry.DirectoryEntry) None [source]
This function is called after an update to the directory structure. During execution of self.execute(), the directory is migrated. On start of looping trough the entries, an auto_flush occurs, calling the migration observer for the directory, which will instantiate yet another instance of the migration. After this inside execute(), the session is not flusing anymore, and we have to skip, since the values are already migrated and migration will fail when removing fieldsets.
- class directory.migration.FieldTypeMigrations[source]
Contains methods to migrate fields from one type to another.