feat(portfolios): add unified ledger history API
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""portfolio_ledger: keyset pagination index for unified ledger reads
|
||||
|
||||
Revision ID: 20260820_0030
|
||||
Revises: 20260814_0029
|
||||
Create Date: 2026-08-20 10:50:00
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
from sqlalchemy import text
|
||||
|
||||
revision = "20260820_0030"
|
||||
down_revision = "20260814_0029"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
_INDEX = "idx_portfolio_ledger_portfolio_recorded_entry_desc"
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.get_bind().execute(
|
||||
text(
|
||||
f"CREATE INDEX IF NOT EXISTS {_INDEX} "
|
||||
"ON portfolio_ledger (portfolio_id, recorded_at DESC, ledger_entry_id DESC)"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.get_bind().execute(text(f"DROP INDEX IF EXISTS {_INDEX}"))
|
||||
Reference in New Issue
Block a user