SQLite
Migrations run into an in-memory better-sqlite3 template. Each test clone is written to a temp directory and cleaned up automatically.
@farbenmeer/prisma-migrate-test solves the slow-migration problem in Prisma test suites. Migrations run once to build an in-memory template, then each test gets a cheap clone — no repeated migration overhead per test.
npm install @farbenmeer/prisma-migrate-testSQLite
Migrations run into an in-memory better-sqlite3 template. Each test clone is written to a temp directory and cleaned up automatically.
PGlite
Migrations run into an in-memory PGlite instance and the result is dumped. Each test clone is restored from that dump — no real Postgres required. Supports optional seeding and per-test reset().
npm install better-sqlite3 @prisma/adapter-better-sqlite3npm install -D @types/better-sqlite3import { createSqliteTestDb } from "@farbenmeer/prisma-migrate-test/sqlite";import { PrismaClient } from "@prisma/client";import { afterAll, afterEach, beforeAll, beforeEach } from "vitest";
let testDb: SqliteTestDb;let prisma: PrismaClient;
beforeAll(() => { testDb = createSqliteTestDb({ migrationsPath: "prisma/migrations" });});afterAll(() => testDb.cleanup());
beforeEach(async () => { prisma = new PrismaClient({ adapter: await testDb.getAdapter() });});afterEach(() => prisma.$disconnect());npm install @electric-sql/pglite pglite-prisma-adapterimport { createPgliteTestDb } from "@farbenmeer/prisma-migrate-test/pglite";import { PrismaClient } from "@prisma/client";import { afterAll, afterEach, beforeAll, beforeEach } from "vitest";
let testDb: PgliteTestDb;let prisma: PrismaClient;
beforeAll(() => { testDb = createPgliteTestDb({ migrationsPath: "prisma/migrations" });});afterAll(() => testDb.cleanup());
beforeEach(async () => { prisma = new PrismaClient({ adapter: await testDb.getAdapter() });});afterEach(() => prisma.$disconnect());