fix(config): fix duplicate migration logic

This was checking a `Version` object against a `MigrationEntry`, but what we want is to check the version object against `MigrationEntry.from_version`
This commit is contained in:
psychedelicious 2024-04-23 17:25:53 +10:00
parent 5d411e446a
commit d12fb7db68

View File

@ -36,7 +36,7 @@ class ConfigMigrator:
"""Define a decorator which registers the migration between two versions."""
def decorator(function: MigrationFunction) -> MigrationFunction:
if from_version in cls._migrations:
if any(from_version == m.from_version for m in cls._migrations):
raise ValueError(
f"function {function.__name__} is trying to register a migration for version {str(from_version)}, but this migration has already been registered."
)