Add migration to version 2 and update tests

This commit is contained in:
thePR0M3TH3AN
2025-07-02 22:16:18 -04:00
parent 0bae741f36
commit 47d9e9d8e4
10 changed files with 70 additions and 37 deletions

View File

@@ -26,7 +26,20 @@ def _v0_to_v1(data: dict) -> dict:
return data
LATEST_VERSION = 1
@migration(1)
def _v1_to_v2(data: dict) -> dict:
passwords = data.pop("passwords", {})
entries = {}
for k, v in passwords.items():
v.setdefault("type", "password")
v.setdefault("notes", "")
entries[k] = v
data["entries"] = entries
data["schema_version"] = 2
return data
LATEST_VERSION = 2
def apply_migrations(data: dict) -> dict: