feat(db): require migration versions to be consecutive

This commit is contained in:
psychedelicious
2023-12-12 09:43:09 +11:00
parent ef8284f009
commit 55acc16b2d
2 changed files with 7 additions and 5 deletions

View File

@ -40,8 +40,8 @@ class Migration(BaseModel):
@model_validator(mode="after")
def validate_to_version(self) -> "Migration":
if self.to_version <= self.from_version:
raise ValueError("to_version must be greater than from_version")
if self.to_version != self.from_version + 1:
raise ValueError("to_version must be one greater than from_version")
return self
def __hash__(self) -> int: