Skip to content

fix: implement down in add-loan-events-missing-indexes to drop indexes#1290

Open
SharifIbrahimDev wants to merge 1 commit into
LabsCrypt:mainfrom
SharifIbrahimDev:fix/migration-rollback-leak
Open

fix: implement down in add-loan-events-missing-indexes to drop indexes#1290
SharifIbrahimDev wants to merge 1 commit into
LabsCrypt:mainfrom
SharifIbrahimDev:fix/migration-rollback-leak

Conversation

@SharifIbrahimDev

Copy link
Copy Markdown

Closes #1193

What does this PR do?

This PR implements the missing down() function in the 1788000000018_add-loan-events-missing-indexes.js migration file, which previously leaked four database indexes on rollback.

Description

  • Clean Rollbacks: Replaced the empty down = () => {} with explicit DROP INDEX IF EXISTS statements for all four indexes (idx_loan_events_borrower, idx_loan_events_event_type, idx_loan_events_loan_id_event_type, and idx_loan_events_created_at) created in the up() function.
  • Idempotency: Ensures that rolling back and re-applying migrations works flawlessly without index collision errors.

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.

[Backend] add-loan-events-missing-indexes has an empty down(), leaking four indexes on rollback

1 participant