Skip to content

A local-first personal finance app

:bug: Fix file path on windows (#7076)

Michael Clarkf97a89dc2807
diff --git a/packages/sync-server/src/migrations.ts b/packages/sync-server/src/migrations.ts
index 363036e9c1..a5c22d7eb0 100644
--- a/packages/sync-server/src/migrations.ts
+++ b/packages/sync-server/src/migrations.ts
@@ -1,6 +1,6 @@
import { readdir } from 'node:fs/promises';
import path, { dirname } from 'node:path';
-import { fileURLToPath } from 'node:url';
+import { fileURLToPath, pathToFileURL } from 'node:url';
import { load } from 'migrate';
@@ -30,7 +30,9 @@ export async function run(direction: 'up' | 'down' = 'up'): Promise<void> {
for (const f of files
.filter(f => f.endsWith('.js') || f.endsWith('.ts'))
.sort()) {
- migrationsModules[f] = await import(path.join(migrationsDir, f));
+ migrationsModules[f] = await import(
+ pathToFileURL(path.join(migrationsDir, f)).href
+ );
}
return new Promise<void>((resolve, reject) => {
diff --git a/upcoming-release-notes/7076.md b/upcoming-release-notes/7076.md
new file mode 100644
index 0000000000..650997cf66
--- /dev/null
+++ b/upcoming-release-notes/7076.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MikesGlitch]
+---
+
+Fix server migrations when running on Windows