Files
aurum/backend/alembic/versions/3b7c941bbadf_add_idle_cash_thresholds.py
ZProger 09a0e383e0 feat: idle cash alert and category hierarchy (subcategories)
Two of the four ideas picked from the Maybe/Sure feature audit:

- Idle cash: a 5th proactive alert flags a depository account (checking/
  savings/cash) sitting at or above a configurable balance with no
  transaction touching it for a configurable number of days.
- Category hierarchy: categories can now have one level of subcategories
  (Groceries -> Alcohol). Dashboard/report aggregations roll a
  subcategory's spending into its parent's slice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 02:27:46 +03:00

37 lines
1.1 KiB
Python

"""add idle cash thresholds to app_settings
Revision ID: 3b7c941bbadf
Revises: a71d9f0c3e58
Create Date: 2026-08-25 10:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '3b7c941bbadf'
down_revision: Union[str, None] = 'a71d9f0c3e58'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
'app_settings',
sa.Column('idle_cash_threshold_amount', sa.Numeric(14, 2), nullable=False, server_default='1000'),
)
op.add_column(
'app_settings',
sa.Column('idle_cash_threshold_days', sa.Integer(), nullable=False, server_default='60'),
)
op.alter_column('app_settings', 'idle_cash_threshold_amount', server_default=None)
op.alter_column('app_settings', 'idle_cash_threshold_days', server_default=None)
def downgrade() -> None:
op.drop_column('app_settings', 'idle_cash_threshold_days')
op.drop_column('app_settings', 'idle_cash_threshold_amount')