- Transfer-Regel kann direkt ein Zielkonto tragen (target_account_id); ohne -> weiterhin Auto-Erkennung aus dem Buchungstext (Konto-Texte) - Migration 0010; Endpunkt aktualisiert bestehendes Wort statt Konflikt - Import bevorzugt das feste Zielkonto, sonst _guess_target_account - Konten-Seite: Transfer-Erkennung mit Zielkonto-Auswahl + Anzeige am Chip - Test: festes Zielkonto greift ohne Konto-Texte (75 grün) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
941 B
Python
32 lines
941 B
Python
"""Transfer-Regeln: optionales festes Zielkonto.
|
|
|
|
Erlaubt, einem Transfer-Schlagwort direkt ein Zielkonto zuzuweisen (z. B.
|
|
„REVOLUT" -> Konto Revolut). Ohne Zielkonto wird es weiterhin aus dem
|
|
Buchungstext erraten.
|
|
|
|
Revision ID: 0010
|
|
Revises: 0009
|
|
Create Date: 2026-08-20
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "0010"
|
|
down_revision = "0009"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
with op.batch_alter_table("categorization_rules") as batch:
|
|
batch.add_column(sa.Column("target_account_id", sa.Integer(), nullable=True))
|
|
batch.create_foreign_key(
|
|
"fk_rule_target_account", "accounts", ["target_account_id"], ["id"], ondelete="SET NULL"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
with op.batch_alter_table("categorization_rules") as batch:
|
|
batch.drop_constraint("fk_rule_target_account", type_="foreignkey")
|
|
batch.drop_column("target_account_id")
|