Skip to content

Commit

Permalink
Fix config migration from 45a0cdb
Browse files Browse the repository at this point in the history
  • Loading branch information
FestplattenSchnitzel committed Nov 14, 2024
1 parent 13fa3f6 commit 0f8fab0
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# revision identifiers, used by Alembic.
revision = "b64618e97415"
down_revision = "5234d7ac2b4a"
down_revision = "dda39ad43536"
branch_labels = None
depends_on = None

Expand All @@ -23,13 +23,19 @@ def upgrade():
sa.Column(
"non_attributable_transactions_account_id",
sa.Integer(),
nullable=False,
server_default="33200",
nullable=True,
),
)
op.create_foreign_key(
None, "config", "account", ["non_attributable_transactions_account_id"], ["id"]
)
op.execute(
"insert into account (name, type, legacy) (select name, type, legacy from (select 'Beiträge, Mitglied nicht zuordenbar' as name, account_type('REVENUE') as type, false as legacy) as a where not exists (select * from account where name = 'Beiträge, Mitglied nicht zuordenbar' and type = 'REVENUE'))"
)
op.execute(
"update config set non_attributable_transactions_account_id=(select id from account where name = 'Beiträge, Mitglied nicht zuordenbar' and type = 'REVENUE')"
)
op.alter_column("config", "non_attributable_transactions_account_id", nullable=False)


def downgrade():
Expand Down

0 comments on commit 0f8fab0

Please sign in to comment.