chore: snapshot workflow migration progress
This commit is contained in:
@@ -5,7 +5,7 @@ to create notification rows in the audit_log table.
|
||||
"""
|
||||
import logging
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy import create_engine, select
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -23,6 +23,11 @@ CHANNEL_ALERT = "alert" # admin-only infrastructure issues
|
||||
_engine = None
|
||||
|
||||
|
||||
def _utcnow_naive() -> datetime:
|
||||
"""Return UTC as a naive datetime for legacy TIMESTAMP WITHOUT TIME ZONE columns."""
|
||||
return datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
|
||||
|
||||
def _get_engine():
|
||||
global _engine
|
||||
if _engine is None:
|
||||
@@ -53,7 +58,7 @@ async def emit_notification(
|
||||
details=details,
|
||||
notification=True,
|
||||
channel=channel,
|
||||
timestamp=datetime.utcnow(),
|
||||
timestamp=_utcnow_naive(),
|
||||
)
|
||||
db.add(entry)
|
||||
await db.commit()
|
||||
@@ -85,7 +90,7 @@ def emit_notification_sync(
|
||||
details=details,
|
||||
notification=True,
|
||||
channel=channel,
|
||||
timestamp=datetime.utcnow(),
|
||||
timestamp=_utcnow_naive(),
|
||||
)
|
||||
session.add(entry)
|
||||
session.commit()
|
||||
@@ -149,7 +154,7 @@ def emit_batch_render_notification_sync(order_id: str) -> None:
|
||||
},
|
||||
notification=True,
|
||||
channel=CHANNEL_NOTIFICATION,
|
||||
timestamp=datetime.utcnow(),
|
||||
timestamp=_utcnow_naive(),
|
||||
)
|
||||
session.add(entry)
|
||||
session.commit()
|
||||
|
||||
Reference in New Issue
Block a user