From 3feaa719443aa30b1121d928ba5b7b8f43837ffb Mon Sep 17 00:00:00 2001 From: David Luecke Date: Wed, 13 Mar 2024 10:21:16 -0700 Subject: [PATCH] fix(generators): Use module format for JS Knex migrations (#3444) --- packages/generators/src/connection/templates/knex.tpl.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/generators/src/connection/templates/knex.tpl.ts b/packages/generators/src/connection/templates/knex.tpl.ts index dd48cc90a1..96ff13a18a 100644 --- a/packages/generators/src/connection/templates/knex.tpl.ts +++ b/packages/generators/src/connection/templates/knex.tpl.ts @@ -55,13 +55,13 @@ export const generate = (ctx: ConnectionGeneratorContext) => .then(renderSource(knexfile, toFile('knexfile'))) .then( mergeJSON( - { + (ctx) => ({ scripts: { migrate: 'knex migrate:latest', - 'migrate:make': 'knex migrate:make', + 'migrate:make': 'knex migrate:make' + ctx.language === 'js' ? ' -x mjs' : '', test: 'cross-env NODE_ENV=test npm run migrate && npm run mocha' } - }, + }), toFile('package.json') ) )