Skip to content

fix(budget): cascade-delete budget lines when deleting a budget - #379

Merged
arutsh merged 1 commit into
mainfrom
Budget/fix/Issue-378/budget-delete-with-lines-cascade
Oct 1, 2026
Merged

arutsh merged 1 commit into
mainfrom
Budget/fix/Issue-378/budget-delete-with-lines-cascade

Conversation

@arutsh

@arutsh arutsh commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • BudgetModel.lines now uses cascade="all, delete-orphan" + passive_deletes=True
  • Migration 000021 adds ON DELETE CASCADE to budget_lines.budget_id
  • Real-DB tests for deleting a budget with loaded and unloaded lines
  • Budgets whose lines have report lines still return 400

Should fix money-precision.spec.ts:47 and auth-budget-crud.spec.ts:91 in E2E.

Closes #378

🤖 Generated with Claude Code

BudgetModel.lines now uses cascade="all, delete-orphan" with passive_deletes=True,
and budget_lines.budget_id gets ON DELETE CASCADE (migration 000021). Previously the
ORM nulled budget_id on delete, violating NOT NULL and surfacing as a 400.

Budgets whose lines have report lines still fail with 400.

Closes #378

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
grant-flow Ready Ready Preview Oct 1, 2026 3:42pm UTC

@arutsh
arutsh merged commit 0d54e42 into main Oct 1, 2026
28 of 29 checks passed
@arutsh
arutsh deleted the Budget/fix/Issue-378/budget-delete-with-lines-cascade branch October 10, 2026 09:00

This branch was successfully deployed

2 active deployments
Production — 0d54e42f Deployed Oct 1, 2026 by vercel[bot]
Preview — 0d54e42f Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(budget): deleting a budget that still has lines returns 400

1 participant