Skip to content

Commit

Permalink
fix shadow database for keystone migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Apr 29, 2024
1 parent 002409c commit 87cd540
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core/src/scripts/migrate.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
])
Expand All @@ -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'
Expand Down

0 comments on commit 87cd540

Please sign in to comment.