MCPcopy
hub / github.com/prisma/prisma / validateExperimentalFeatures

Function validateExperimentalFeatures

packages/config/src/defineConfig.ts:11–37  ·  packages/config/src/defineConfig.ts::validateExperimentalFeatures

* Validates that experimental features are enabled when using corresponding configuration options.

(config: PrismaConfig)

Source from the content-addressed store, hash-verified

9 * Validates that experimental features are enabled when using corresponding configuration options.
10 */
11function validateExperimentalFeatures(config: PrismaConfig): Either.Either<PrismaConfig, Error> {
12 const experimental = config.experimental || {}
13
14 class="cm">// Check external tables configuration
15 if (config.tables?.external && !experimental.externalTables) {
16 return Either.left(
17 new Error(class="st">'The `tables.external` configuration requires `experimental.externalTables` to be set to `true`.'),
18 )
19 }
20
21 class="cm">// Check migrations initShadowDb configuration
22 if (config.migrations?.initShadowDb && !experimental.externalTables) {
23 return Either.left(
24 new Error(
25 class="st">'The `migrations.initShadowDb` configuration requires `experimental.externalTables` to be set to `true`.',
26 ),
27 )
28 }
29
30 if (config[class="st">'extensions'] !== undefined && !experimental.extensions) {
31 return Either.left(
32 new Error(class="st">'The `extensions` configuration requires `experimental.extensions` to be set to `true`.'),
33 )
34 }
35
36 return Either.right(config)
37}
38
39export type { PrismaConfigInternal }
40

Callers 1

defineConfigFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected