Migration engine base class. It defines all the magic to make things easy to use. To migrate a raw schema, only instanciate the migrator and “call” the instance with the raw_dict.
>>> migrator = DataMigration() >>> migrated_raw_data = migrator(raw_data)
Migrators must derive from this class and implement methods of the form - check_N(raw_data) -> returns True if raw_data is compatible with version N - migrate_to_N(raw_data) -> migrate from previous version to this one
check_N are all called in the decreasing order. The first to return True determines the version.
All migrators functions are called successively starting at N+1 assuming N is the current version number
N version numbers do not need to be consecutive and are sorted in natural order.
Gather all the version detectors and migrators on the first call. They are then cached for all further instances.
|Parameters:||model – model class this migrator handles|