Skip to content

[BUG] Rollback runner doesn't restore indexes dropped by the corresponding forward migration #880

Open

Description

@meshackyaro

Bug Description

A forward migration that drops an index as part of a column change has no matching down() step to recreate it, so rolling back leaves the schema in a degraded (missing-index) state.

Component

  • Backend
  • Frontend
  • Smart Contract
  • SDK
  • Documentation
  • Other:

Steps to Reproduce

  1. Apply the migration that drops idx_escrow_wallet.
  2. Trigger a rollback via the admin-triggered rollback endpoint.
  3. Inspect the resulting schema.
  4. Check whether idx_escrow_wallet was recreated.

Expected Behavior

Rolling back a migration should fully restore the prior schema, including indexes.

Actual Behavior

The table/column is restored but the index is not, silently degrading query performance until someone notices and manually recreates it.

Environment

  • Node Version: 20.x
  • OS: Linux / macOS
  • Browser (if applicable): N/A
  • Network (Testnet/Mainnet): Testnet

Error Messages/Logs

N/A — no error output; behavior is incorrect but silent.

Screenshots

N/A — backend/API issue, not applicable.

Additional Context

The migration's down() method is incomplete relative to its up() method.

Possible Solution

Audit all migrations for symmetric up/down steps, and add a migration-linter check (or test) that flags asymmetric index changes.

Activity

  1. added
    bug
    difficulty: medium
    priority: medium
    on Oct 29, 2026
  2. maxx-GENIUS commented on Nov 1, 2026

    @maxx-GENIUS

    Hey @trustflow-protocol team,

    I looked into this issue. It seems rollback runner doesn't restore indexes dropped by the corresponding forward migration. I can implement a targeted fix for this following project standards, and write unit tests to reproduce the scenario and confirm the fix passes all checks.

    Happy to take this on if you can assign it over.

  3. GangDev6707 commented on Nov 2, 2026

    @GangDev6707

    Hi maintainers,

    I'd like to help resolve this issue. We need to resolve 'rollback runner doesn't restore indexes dropped by the corresponding forward migration' cleanly across the target modules. I plan to trace the current code execution path to isolate the behavior boundary and implement a focused, modular fix for 'rollback runner doesn't restore indexes dropped by the corresponding forward migration' adhering strictly to repository architecture, followed by ensure defensive guards and backward compatibility are maintained.

    I'll reproduce the target scenario locally, add regression unit tests, and confirm all CI checks pass 100% green to verify everything passes cleanly.

    Happy to take this on if you can assign it over. Will get a clean PR ready promptly.

  4. ranjan1969x commented on Nov 8, 2026

    @ranjan1969x

    Hi @trustflow-protocol maintainers,

    I reviewed the issue for Rollback runner doesn't restore indexes dropped by the corresponding forward migration. We need to resolve 'rollback runner doesn't restore indexes dropped by the corresponding forward migration' cleanly across the target modules.

    Proposed Implementation:

    1. Trace the current code execution path to isolate the behavior boundary.
    2. Implement a focused, modular fix for 'Rollback runner doesn't restore indexes dropped by the corresponding forward migration' adhering strictly to repository architecture.
    3. Ensure defensive guards and backward compatibility are maintained.

    Testing & Verification:
    I will reproduce the target scenario locally, add regression unit tests, and confirm all CI checks pass 100% green.

    Looking forward to working on it if assigned. Ready to implement the fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdatabasedevopsdifficulty: mediumpriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions