prisma/prisma
PrismaConfigInternal
The parsed shape of prisma.config.ts. Defined in @prisma/config (packages/config/src/). Consumed by @prisma/cli, @prisma/migrate, and @prisma/internals.
Where it appears
Almost every CLI subcommand starts with:
const config: PrismaConfigInternal = await loadConfig(...)The result then flows into Migrate, Generate, Studio, etc.
Top-level fields
From the loader's behavior:
schema— path toschema.prisma(or directory for multi-file)migrations—{ path }for migration files locationdatasource—{ url, schemas? }connection infoloadedFromFile—truewhen the config came from disk;falsewhen synthesized in testsstudio?— Studio-specific overrides- … plus subsystem-specific fields
The exact shape is the source of truth — see packages/config/src/.
loadedFromFile is load-bearing
This boolean affects how relative paths resolve. Notably, SQLite URLs are resolved relative to the config file, not the schema file when loadedFromFile is true. From AGENTS.md:
SQLite datasource URLs now resolve relative to the config file and not to the schema.
If you're constructing a PrismaConfigInternal in tests or in Studio's isolated dev path, set loadedFromFile: true (and provide a real-looking config path) to get correct SQLite resolution.
Test helpers
packages/migrate/src/__tests__/__helpers__/context.ts exposes:
ctx.setConfigFile(name)— point the next CLI invocation at a specific config in fixtures; auto-resetctx.setDatasource(url)/ctx.resetDatasource()— overrideconfig.datasource.urlfor one invocation
The corresponding helper module is packages/migrate/src/__tests__/__helpers__/prismaConfig.ts.
Defining a config
User-facing API:
import { defineConfig, env } from 'prisma/config';
export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: { path: 'prisma/migrations' },
datasource: {
url: env<{ DATABASE_URL: string }>('DATABASE_URL'),
},
});defineConfig is identity at runtime; it only adds types. env(name) reads process.env[name] and throws if missing.
See also
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.