Version bump for the Migrations and Database handling
This commit is contained in:
parent
a9b6b9ffe3
commit
a085586448
4 changed files with 26 additions and 4 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
# Major Change Log:
|
# 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
|
# 2.3.9
|
||||||
July 11, 2026
|
July 11, 2026
|
||||||
Features: Revamp of GET/POST API requests for both Tor and Clearweb.
|
Features: Revamp of GET/POST API requests for both Tor and Clearweb.
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,12 @@ Metaphor:
|
||||||
This replaces something like alembic, by doing it directly
|
This replaces something like alembic, by doing it directly
|
||||||
|
|
||||||
Confusion:
|
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.
|
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:
|
def migrate_sql() -> DatabaseOperation:
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,16 @@ from typing import Type, Dict, Any, Callable, TypeVar
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from enum import Enum
|
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 safe_db_operation(func):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|
@ -95,8 +105,13 @@ def safe_db_operation(func):
|
||||||
return wrapper
|
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):
|
class WrapperRollback(Exception):
|
||||||
"""Raised by wrapped function to signal wrapper should rollback and return error."""
|
|
||||||
def __init__(self, database_operation: DatabaseOperation):
|
def __init__(self, database_operation: DatabaseOperation):
|
||||||
self.database_operation = database_operation
|
self.database_operation = database_operation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "sp-hydra-veil-core"
|
name = "sp-hydra-veil-core"
|
||||||
version = "2.3.9"
|
version = "2.4.0"
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Simplified Privacy" },
|
{ name = "Simplified Privacy" },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue