Add schema v3 migration and update tests

This commit is contained in:
thePR0M3TH3AN
2025-07-04 19:31:31 -04:00
parent b3ee860fd2
commit f2b6219dc0
4 changed files with 73 additions and 13 deletions

View File

@@ -39,7 +39,18 @@ def _v1_to_v2(data: dict) -> dict:
return data
LATEST_VERSION = 2
@migration(2)
def _v2_to_v3(data: dict) -> dict:
"""Add custom_fields and origin defaults to each entry."""
entries = data.get("entries", {})
for entry in entries.values():
entry.setdefault("custom_fields", [])
entry.setdefault("origin", "")
data["schema_version"] = 3
return data
LATEST_VERSION = 3
def apply_migrations(data: dict) -> dict: