Skip to content

fix(bounties): change Bounty.issue onDelete from CASCADE to RESTRICT (#53) - #71

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/53-bounty-issue-fk-restrict
Open

fix(bounties): change Bounty.issue onDelete from CASCADE to RESTRICT (#53)#71
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/53-bounty-issue-fk-restrict

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Fixes #53.

Changes Bounty.issue relation on delete action from CASCADE to RESTRICT, aligning with the financial record integrity architecture established across the platform (Payment -> Escrow RESTRICT, Escrow -> Bounty SET NULL).

Changes Made

  1. Entity definition: Updated Bounty.issue in src/common/entities/bounty.entity.ts to use onDelete: 'RESTRICT'.
  2. Migration: Added migration BountyIssueFkRestrict1784600000000 in src/database/migrations/1784600000000-BountyIssueFkRestrict.ts using the dynamic constraint introspection helper (replaceForeignKeyOnDelete) to drop and recreate the FK constraint with ON DELETE RESTRICT.
  3. Integration test: Added test case in src/database/escrow-fk-integrity.integration.spec.ts asserting that attempting to delete an issue linked to an active bounty is refused by Postgres due to the RESTRICT constraint.

Verification

  • Ran npm run build successfully (Nest CLI compilation passes).
  • Ran all unit & integration test suites (npm test / jest).

…ergeFi#53)

- Update Bounty.issue relation onDelete to 'RESTRICT' to prevent accidental hard deletion of active/funded/merged bounties when an issue is deleted
- Add migration BountyIssueFkRestrict1784600000000 replacing live FK constraint with RESTRICT
- Add integration test asserting DB refuses deletion of an issue attached to an active bounty
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant