migration: preserve sentiment and pools slice
This commit is contained in:
+2
-21
@@ -9,6 +9,7 @@ from typing import Any
|
||||
from backend.database import MIGRATIONS, MigrationRunner, SQLiteConnectionFactory
|
||||
from backend.features.accounts.repository import AccountRepositoryMixin
|
||||
from backend.features.market.repository import MarketRepositoryMixin
|
||||
from backend.features.pools.repository import PoolRepositoryMixin
|
||||
from backend.features.system.repository import SystemSettingsRepositoryMixin
|
||||
|
||||
|
||||
@@ -24,6 +25,7 @@ def _optional_float(value: Any) -> float | None:
|
||||
class ReviewDatabase(
|
||||
AccountRepositoryMixin,
|
||||
MarketRepositoryMixin,
|
||||
PoolRepositoryMixin,
|
||||
SystemSettingsRepositoryMixin,
|
||||
):
|
||||
def __init__(self, path: Path) -> None:
|
||||
@@ -836,27 +838,6 @@ class ReviewDatabase(
|
||||
)
|
||||
return cursor.rowcount > 0
|
||||
|
||||
def save_reason_override(self, trade_date: str, code: str, reason: str) -> None:
|
||||
now = datetime.now().astimezone().isoformat(timespec="seconds")
|
||||
with self.connect() as connection:
|
||||
connection.execute(
|
||||
"""
|
||||
INSERT INTO reason_overrides (trade_date, code, reason, updated_at)
|
||||
VALUES (?, ?, ?, ?)
|
||||
ON CONFLICT(trade_date, code) DO UPDATE SET
|
||||
reason = excluded.reason,
|
||||
updated_at = excluded.updated_at
|
||||
""",
|
||||
(trade_date, code, reason, now),
|
||||
)
|
||||
|
||||
def reason_overrides(self, trade_date: str) -> dict[str, str]:
|
||||
with self.connect() as connection:
|
||||
rows = connection.execute(
|
||||
"SELECT code, reason FROM reason_overrides WHERE trade_date = ?",
|
||||
(trade_date,),
|
||||
).fetchall()
|
||||
return {row["code"]: row["reason"] for row in rows}
|
||||
|
||||
def list_seat_aliases(self) -> dict[str, str]:
|
||||
with self.connect() as connection:
|
||||
|
||||
Reference in New Issue
Block a user