Skip to content

Commit e2b5f40

Browse files
committed
warn Prisma 6 users to use prisma-kysely v2.x
1 parent c25e269 commit e2b5f40

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/generator.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ generatorHandler({
2929
};
3030
},
3131
onGenerate: async (options: GeneratorOptions) => {
32+
if (!options.version) {
33+
throw new Error(
34+
`Could not determine Prisma version. ` +
35+
`Make sure you are using a recent version of Prisma.`
36+
);
37+
}
38+
39+
const semverMatch = options.version.match(/^(\d+)\./);
40+
if (semverMatch && parseInt(semverMatch[1], 10) < 7) {
41+
throw new Error(
42+
`prisma-kysely v${version} requires Prisma 7 or later. ` +
43+
`You are using Prisma ${options.version}. ` +
44+
`Please upgrade Prisma or use prisma-kysely v2.x for Prisma 6.`
45+
);
46+
}
47+
3248
// Parse the config
3349
const config = validateConfig({
3450
...options.generator.config,

0 commit comments

Comments
 (0)