diff options
-rw-r--r-- | paste/db.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/paste/db.py b/paste/db.py index 692b01f..25e85ce 100644 --- a/paste/db.py +++ b/paste/db.py @@ -51,6 +51,10 @@ def get_version(connection: sqlite3.Connection) -> int: def migrate(connection: sqlite3.Connection, migrations: list[str]) -> None: version = get_version(connection) + if len(migrations) < version: + raise RuntimeError( + f"Attempt to downgrade from v{version} to v{len(migrations)}" + ) for i in count(version + 1): if i - 1 >= len(migrations): break |