Skip to content

Commit

Permalink
fix introspection command
Browse files Browse the repository at this point in the history
  • Loading branch information
timsuchanek committed Dec 4, 2019
1 parent ed68e92 commit 5fa482b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion cli/introspection/src/commands/Introspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getConfig, IntrospectionEngine, getDMMF, dmmfToDml } from '@prisma/sdk'
import { formatms } from '../util/formatms'
import fs from 'fs'
import { ConfigMetaFormat } from '@prisma/sdk/dist/isdlToDatamodel2'
import { predefinedGeneratorResolvers } from '@prisma/sdk/dist/predefinedGeneratorResolvers'

/**
* $ prisma migrate new
Expand Down Expand Up @@ -97,6 +96,10 @@ export class Introspect implements Command {
const introspectionSchema = await engine.introspect(url)
engine.stop()

if (introspectionSchema.trim() === '') {
throw new Error(`Empty introspection result for ${chalk.underline(url)}`)
}

try {
const dmmf = await getDMMF({ datamodel: introspectionSchema })
const schema = await dmmfToDml({
Expand Down
2 changes: 1 addition & 1 deletion cli/sdk/src/IntrospectionEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ export class IntrospectionEngine {
...env,
RUST_LOG: 'info',
RUST_BACKTRACE: '1',
PWD: this.cwd,
},
cwd: this.cwd,
})

this.child.on('error', err => {
Expand Down

0 comments on commit 5fa482b

Please sign in to comment.