Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dependencies": {
"@prisma/generator-helper": "6.19.x",
"@prisma/internals": "6.19.x",
"@prisma/internals-v7": "npm:@prisma/internals@7",
"@zenstackhq/language": "workspace:*",
"@zenstackhq/runtime": "workspace:*",
"langium": "1.3.1",
Expand Down
10 changes: 8 additions & 2 deletions packages/sdk/src/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import type { DMMF } from '@prisma/generator-helper';
import { getDMMF as _getDMMF, type GetDMMFOptions } from '@prisma/internals';
import { getDMMF as _getDMMF7 } from '@prisma/internals-v7';
import { DEFAULT_RUNTIME_LOAD_PATH } from '@zenstackhq/runtime';
import path from 'path';
import semver from 'semver';
import { Model } from './ast';
import { RUNTIME_PACKAGE } from './constants';
import { normalizedRelative } from './path';
import type { PluginOptions } from './types';
import { getDataSourceProvider } from './utils';
import { normalizedRelative } from './path';

/**
* Given an import context directory and plugin options, compute the import spec for the Prisma Client.
Expand Down Expand Up @@ -51,7 +52,12 @@ function normalizePath(p: string) {
* Loads Prisma DMMF
*/
export function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document> {
return _getDMMF(options);
const prismaVersion = getPrismaVersion();
if (prismaVersion && semver.gte(prismaVersion, '7.0.0')) {
return _getDMMF7(options);
} else {
return _getDMMF(options);
}
}

/**
Expand Down
130 changes: 128 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading