From bc8457e996ade2ccd6977bcde31a4c366b01325a Mon Sep 17 00:00:00 2001 From: Brainslug Date: Thu, 6 Apr 2023 15:04:18 +0200 Subject: [PATCH] Windows compatibility for running migrations (#18082) * Prepend the file:// prefix for windows compatibility in migrations * cla --- api/src/database/migrations/run.ts | 6 +++--- contributors.yml | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/src/database/migrations/run.ts b/api/src/database/migrations/run.ts index a67c69bfe7..515cf7b5fa 100644 --- a/api/src/database/migrations/run.ts +++ b/api/src/database/migrations/run.ts @@ -67,7 +67,7 @@ export default async function run(database: Knex, direction: 'up' | 'down' | 'la throw Error('Nothing to upgrade'); } - const { up } = await import(nextVersion.file); + const { up } = await import(`file://${nextVersion.file}`); if (log) { logger.info(`Applying ${nextVersion.name}...`); @@ -90,7 +90,7 @@ export default async function run(database: Knex, direction: 'up' | 'down' | 'la throw new Error("Couldn't find migration"); } - const { down } = await import(migration.file); + const { down } = await import(`file://${migration.file}`); if (log) { logger.info(`Undoing ${migration.name}...`); @@ -103,7 +103,7 @@ export default async function run(database: Knex, direction: 'up' | 'down' | 'la async function latest() { for (const migration of migrations) { if (migration.completed === false) { - const { up } = await import(migration.file); + const { up } = await import(`file://${migration.file}`); if (log) { logger.info(`Applying ${migration.name}...`); diff --git a/contributors.yml b/contributors.yml index ae595b631f..4d6d27250e 100644 --- a/contributors.yml +++ b/contributors.yml @@ -1,2 +1,3 @@ - rijkvanzanten - paescuj +- br41nslug