Removes legacy equity accounts

Removes generic equity accounts that are no longer necessary
due to the user-specific equity model introduced by the
castle extension. Specifically, it removes
"Equity:MemberEquity" and "Equity:RetainedEarnings" accounts.
This commit is contained in:
padreug 2025-11-08 10:14:38 +01:00
parent eefabc3441
commit 0b50ba0f82

View file

@ -516,3 +516,28 @@ async def m013_remove_parent_only_accounts(db):
"DELETE FROM accounts WHERE name = :name",
{"name": "Equity"}
)
async def m014_remove_legacy_equity_accounts(db):
"""
Remove legacy generic equity accounts that don't fit the user-specific equity model.
The castle extension uses dynamic user-specific equity accounts (Equity:User-{user_id})
created automatically when granting equity eligibility. Generic equity accounts like
MemberEquity and RetainedEarnings are not needed.
Removes:
- Equity:MemberEquity
- Equity:RetainedEarnings
"""
# Remove Equity:MemberEquity
await db.execute(
"DELETE FROM accounts WHERE name = :name",
{"name": "Equity:MemberEquity"}
)
# Remove Equity:RetainedEarnings
await db.execute(
"DELETE FROM accounts WHERE name = :name",
{"name": "Equity:RetainedEarnings"}
)