[PR #6346] Fix sync server migrations #20818

Closed
opened 2026-04-14 21:46:04 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/6346

State: closed
Merged: Yes


This fixes npx vitest run following the recent ESM loader changes in the sync-server module.

  • Rename migrations.js to migrations.ts
  • Adds some types
  • Uses migrations instead of migrationsDirectory

Note

Rewrites the sync-server migrations runner to TypeScript using ESM and dynamic imports, switching to migrate.load with a migrations map and adding release notes.

  • Sync Server:
    • Migrations runner: Rewritten in packages/sync-server/src/migrations.ts to TypeScript and ESM.
      • Dynamically imports migration files from ../migrations (.js/.ts), sorted.
      • Uses load({ stateStore, migrations }) instead of migrationsDirectory.
      • Supports run(direction: 'up' | 'down') with improved error handling and logging.
  • Release Notes:
    • Adds upcoming-release-notes/6346.md (Bugfix) noting ESM loader change for migrations.

Written by Cursor Bugbot for commit 25b92d407f. This will update automatically on new commits. Configure here.

**Original Pull Request:** https://github.com/actualbudget/actual/pull/6346 **State:** closed **Merged:** Yes --- This fixes `npx vitest run` following the recent ESM loader changes in the sync-server module. * Rename migrations.js to migrations.ts * Adds some types * Uses `migrations` instead of `migrationsDirectory` <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes. Try running yarn generate:release-notes *before* pushing your PR for an interactive experience. --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Rewrites the sync-server migrations runner to TypeScript using ESM and dynamic imports, switching to migrate.load with a migrations map and adding release notes. > > - **Sync Server**: > - **Migrations runner**: Rewritten in `packages/sync-server/src/migrations.ts` to TypeScript and ESM. > - Dynamically imports migration files from `../migrations` (`.js`/`.ts`), sorted. > - Uses `load({ stateStore, migrations })` instead of `migrationsDirectory`. > - Supports `run(direction: 'up' | 'down')` with improved error handling and logging. > - **Release Notes**: > - Adds `upcoming-release-notes/6346.md` (Bugfix) noting ESM loader change for migrations. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 25b92d407f632c024fb26196dd0deb897a4f1386. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
GiteaMirror added the pull-request label 2026-04-14 21:46:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#20818