"""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")