From 87cd54057e519f23dac5080d5d51699b3ded8f4d Mon Sep 17 00:00:00 2001 From: Daniel Cousens <413395+dcousens@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:53:36 +1000 Subject: [PATCH] fix shadow database for keystone migrate --- packages/core/src/scripts/migrate.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/core/src/scripts/migrate.ts b/packages/core/src/scripts/migrate.ts index 48b778ed367..f2f98f325fb 100644 --- a/packages/core/src/scripts/migrate.ts +++ b/packages/core/src/scripts/migrate.ts @@ -1,9 +1,8 @@ +import esbuild from 'esbuild' import fse from 'fs-extra' import { join } from 'node:path' import { spawn } from 'node:child_process' -import esbuild from 'esbuild' - import { createSystem, getBuiltKeystoneConfiguration @@ -77,6 +76,9 @@ provider = ${system.config.db.provider}`) const paths = system.getPaths(cwd) const { output: summary, exitCode: prismaExitCode } = await spawnPrisma(cwd, system, [ 'migrate', 'diff', + ...(system.config.db.shadowDatabaseUrl ? [ + '--shadow-database-url', system.config.db.shadowDatabaseUrl + ] : []), '--from-migrations', 'migrations/', '--to-schema-datamodel', paths.schema.prisma, ]) @@ -94,6 +96,9 @@ provider = ${system.config.db.provider}`) console.log(summary) const { output: sql, exitCode: prismaExitCode2 } = await spawnPrisma(cwd, system, [ 'migrate', 'diff', + ...(system.config.db.shadowDatabaseUrl ? [ + '--shadow-database-url', system.config.db.shadowDatabaseUrl + ] : []), '--from-migrations', 'migrations/', '--to-schema-datamodel', paths.schema.prisma, '--script'