Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): test getConfig provider array fix #8529

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/packages/cli/src/bin.ts
Expand Up @@ -189,14 +189,27 @@ async function main(): Promise<number> {
let schemaProvider: string | undefined
let schemaPreviewFeatures: string[] | undefined
let schemaGeneratorsProviders: string[] | undefined

try {
const schema = await getSchema(args['--schema'])
const config = await getConfig({
datamodel: schema,
Jolg42 marked this conversation as resolved.
Show resolved Hide resolved
ignoreEnvVarErrors: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we forgot to so that a long time ago, without it was throwing when env var was not set for example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #8529

})

// There is a datasource let's see if it has a provider
if (config.datasources.length > 0) {
schemaProvider = config.datasources[0].provider
if (
Array.isArray(config.datasources[0].provider) &&
config.datasources[0].provider[0]
) {
// It shouldn't be an array but it is. See https://github.com/prisma/prisma/issues/8467
schemaProvider = config.datasources[0].provider[0]
} else {
schemaProvider = config.datasources[0].provider
}
}

const generator = config.generators.find(
(gen) => gen.previewFeatures.length > 0,
)
Expand Down