Dual-block migration structure in database.js duplicates every migration entry #59

Closed
opened 2026-05-16 21:43:26 -05:00 by null · 0 comments
Owner

Severity: MEH

Affected Files

  • db/database.jsreconcileLegacyMigrations and runMigrations

Problem

reconcileLegacyMigrations and runMigrations both define the same migration set. A missed sync between the two blocks would silently break rollback or the applied-check.

As migrations grow (currently at v0.64 with rollback paths), the risk of a missed sync increases. This is a maintenance landmine.

Impact

  • Every new migration must be added in two places
  • If one is missed, either rollback breaks or applied-check fails silently
  • No test or assertion verifies the two lists match

Fix Options

  1. Preferred: Extract migrations into a single array/object and reference it from both places
  2. Minimal: Add a test that asserts Object.keys(reconcileMigrations) matches Object.keys(runMigrations)
  3. Thorough: Merge reconcile logic into the main migration runner

Acceptance Criteria

  • Migrations are defined in one place only
  • Or: a test verifies both migration lists match
  • New migrations only need to be added once
## Severity: MEH ⚪ ## Affected Files - `db/database.js` — `reconcileLegacyMigrations` and `runMigrations` ## Problem `reconcileLegacyMigrations` and `runMigrations` both define the same migration set. A missed sync between the two blocks would silently break rollback or the applied-check. As migrations grow (currently at v0.64 with rollback paths), the risk of a missed sync increases. This is a maintenance landmine. ## Impact - Every new migration must be added in two places - If one is missed, either rollback breaks or applied-check fails silently - No test or assertion verifies the two lists match ## Fix Options 1. **Preferred**: Extract migrations into a single array/object and reference it from both places 2. **Minimal**: Add a test that asserts `Object.keys(reconcileMigrations)` matches `Object.keys(runMigrations)` 3. **Thorough**: Merge reconcile logic into the main migration runner ## Acceptance Criteria - [ ] Migrations are defined in one place only - [ ] Or: a test verifies both migration lists match - [ ] New migrations only need to be added once
null added the
architecture
backend
labels 2026-05-16 21:43:26 -05:00
null closed this issue 2026-06-03 22:44:28 -05:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: null/BillTracker#59
No description provided.