prisma-8

Use when working in a project that depends on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo (Prisma 8, formerly Prisma Next): editing contract.prisma or a contract.ts builder, running `prisma contract emit`, planning or applying migrations, editing migration.ts, writing db.orm / db.sql / db.query queries, wiring db.ts or middleware, integrating a build tool, using the Supabase extension or RLS, or reading a dotted error code such as MIGRATION.HASH_MISMATCH. Use when the user asks "what is Prisma 8", "where do I start", or compares it to another ORM. Use when the user asks to upgrade or bump Prisma 8 in an app or an extension package. Use when you see @internal/* or @prisma/orm-* imports, prisma.config.ts with definePrismaConfig, or contract.json / contract.d.ts. Do not use for Prisma ORM 7 or earlier (schema.prisma + @prisma/client).

Install
npx skills add 'https://github.com/prisma/orm/tree/main/skills/prisma-8'
Download bundle ↓
main · fac8604Scanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.ts

upgrading/extension/upgrades/0.11-to-0.12/migrate-contract-testing-imports.tsBrowse 76 files
View on GitHub
← Back to SKILL.md
/** * Rewrites test-only imports from the removed `@internal/contract/testing` * subpath to `@repo/test-utils`. * * Background: starting at 0.12 the contract test factories (`createContract`, * `createSqlContract`, `DUMMY_HASH`, `applicationDomainOf`, …) live in * `@repo/test-utils`. The `@internal/contract/testing` export was * removed from `@internal/contract`. * * Behaviour: * - Walks the project root recursively, ignoring `node_modules`, `.git`, *   `dist`, and `build`. * - Rewrites every `.ts` / `.tsx` file whose source contains *   `@internal/contract/testing`. * - Idempotent: files already importing from `@repo/test-utils` are *   left untouched. * * Flags: *   --check   dry-run; lists files that still need rewriting and exits 1 if *             any remain. */import { readdir, readFile, writeFile } from 'node:fs/promises';import { join } from 'node:path'; const FROM = '@internal/contract/testing';const TO = '@repo/test-utils'; const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', 'build']); const dryRun = process.argv.includes('--check');const projectRoot = process.cwd(); async function findSourceFiles(root: string): Promise<string[]> {  const out: string[] = [];   async function walk(dir: string): Promise<void> {    let entries: Awaited<ReturnType<typeof readdir>>;    try {      entries = await readdir(dir, { withFileTypes: true });    } catch {      return;    }    for (const entry of entries) {      if (entry.isDirectory()) {        if (SKIP_DIRS.has(entry.name)) continue;        await walk(join(dir, entry.name));      } else if (        entry.isFile() &&        (entry.name.endsWith('.ts') || entry.name.endsWith('.tsx')) &&        entry.name !== 'migrate-contract-testing-imports.ts'      ) {        out.push(join(dir, entry.name));      }    }  }   await walk(root);  return out.sort();} const files = await findSourceFiles(projectRoot);const targets: string[] = []; for (const path of files) {  const raw = await readFile(path, 'utf-8');  if (raw.includes(FROM)) targets.push(path);} if (targets.length === 0) {  console.log('No @internal/contract/testing imports found.');  process.exit(0);} let needsFix = 0;let fixed = 0; for (const path of targets) {  const rel = path.slice(projectRoot.length + 1);  const raw = await readFile(path, 'utf-8');  const next = raw.replaceAll(FROM, TO);  if (next === raw) continue;  needsFix += 1;  if (dryRun) {    console.log(`WOULD REWRITE  ${rel}`);    continue;  }  await writeFile(path, next);  fixed += 1;  console.log(`REWRITE  ${rel}`);} console.log();console.log(  `${targets.length} file(s) with legacy import: ${dryRun ? needsFix : fixed} ${dryRun ? 'needing rewrite' : 'rewritten'}.`,); if (dryRun && needsFix > 0) process.exit(1);