From a085586448c63c91090b1758c8e22a51e31ed903 Mon Sep 17 00:00:00 2001 From: SimplifiedPrivacy Date: Wed, 15 Jul 2026 19:02:07 -0400 Subject: [PATCH] Version bump for the Migrations and Database handling --- change_log.md | 4 ++++ core/models/manage/migrations.py | 7 +++++-- core/models/manage/wrapper.py | 17 ++++++++++++++++- pyproject.toml | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/change_log.md b/change_log.md index 01472cb..21f93e0 100644 --- a/change_log.md +++ b/change_log.md @@ -1,5 +1,9 @@ # Major Change Log: +# 2.4.0 +July 15, 2026 +Robust Database Error Handling & Migrations System. For New Client upgrades (Operational Errors) & Old Clients with New JSON keys from an API (TypeErrors). We also added an SQL generic handling wrapper for use across any project or function. + # 2.3.9 July 11, 2026 Features: Revamp of GET/POST API requests for both Tor and Clearweb. diff --git a/core/models/manage/migrations.py b/core/models/manage/migrations.py index 88417e7..76e0a41 100644 --- a/core/models/manage/migrations.py +++ b/core/models/manage/migrations.py @@ -20,9 +20,12 @@ Metaphor: This replaces something like alembic, by doing it directly Confusion: - This may be confusing because we're using SQLAlchemy, + This may be confusing because we're using an ORM in general, but doing migrations manually. - + +Why: + The reason is because alembic is good for servers, but not clients, + due to a large amount of boilerplate for migrations. """ def migrate_sql() -> DatabaseOperation: diff --git a/core/models/manage/wrapper.py b/core/models/manage/wrapper.py index 8ce96e4..5bb00fd 100644 --- a/core/models/manage/wrapper.py +++ b/core/models/manage/wrapper.py @@ -15,6 +15,16 @@ from typing import Type, Dict, Any, Callable, TypeVar from functools import wraps from enum import Enum +""" +Purpose: + This is a wrapper for other SQL functions to catch errors and do solutions/fixes. + +Used/Called by: + insert_into_model + +Returns: + DatabaseOperation Objects +""" def safe_db_operation(func): def wrapper(*args, **kwargs): @@ -95,8 +105,13 @@ def safe_db_operation(func): return wrapper +""" +If a wrapped function needs to pass up an error to this wrapper, +so that the wrapper can roll back sessions, + +Then it uses this error exception and passes the DatabaseOperation object. +""" class WrapperRollback(Exception): - """Raised by wrapped function to signal wrapper should rollback and return error.""" def __init__(self, database_operation: DatabaseOperation): self.database_operation = database_operation diff --git a/pyproject.toml b/pyproject.toml index b986b35..5f7e5df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "sp-hydra-veil-core" -version = "2.3.9" +version = "2.4.0" authors = [ { name = "Simplified Privacy" }, ]