mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 11:06:40 +07:00
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>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
"""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')
|
||||
@@ -0,0 +1,32 @@
|
||||
"""add category parent_id (subcategories)
|
||||
|
||||
Revision ID: 8e2f5a13c9d4
|
||||
Revises: 3b7c941bbadf
|
||||
Create Date: 2026-08-25 10:30:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '8e2f5a13c9d4'
|
||||
down_revision: Union[str, None] = '3b7c941bbadf'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column('categories', sa.Column('parent_id', sa.Integer(), nullable=True))
|
||||
op.create_foreign_key(
|
||||
'fk_categories_parent_id_categories', 'categories', 'categories', ['parent_id'], ['id'], ondelete='SET NULL'
|
||||
)
|
||||
op.create_index('ix_categories_parent_id', 'categories', ['parent_id'])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index('ix_categories_parent_id', table_name='categories')
|
||||
op.drop_constraint('fk_categories_parent_id_categories', 'categories', type_='foreignkey')
|
||||
op.drop_column('categories', 'parent_id')
|
||||
Reference in New Issue
Block a user