From 1c5279747be729b72fcdb262ae5aaa8928476eff Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 12 Mar 2024 16:19:48 +0800 Subject: [PATCH] fix(server): migration script running on windows (#6077) --- packages/backend/server/src/data/commands/run.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/server/src/data/commands/run.ts b/packages/backend/server/src/data/commands/run.ts index 136b7df0d..7d4df391f 100644 --- a/packages/backend/server/src/data/commands/run.ts +++ b/packages/backend/server/src/data/commands/run.ts @@ -1,6 +1,6 @@ import { readdirSync } from 'node:fs'; import { join } from 'node:path'; -import { fileURLToPath } from 'node:url'; +import { fileURLToPath, pathToFileURL } from 'node:url'; import { Logger } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; @@ -25,7 +25,7 @@ export async function collectMigrations(): Promise { const migrations: Migration[] = await Promise.all( migrationFiles.map(async file => { - return import(file).then(mod => { + return import(pathToFileURL(file).href).then(mod => { const migration = mod[Object.keys(mod)[0]]; return {