Skip to content
All findings

Upgrading a Prisma 6 SQLite app to Prisma 7.10: 'The datasource property `url` is no longer supported in schema files', and 4 more breaks

Published 1 Dec 2026

I upgraded a small Node + SQLite app from Prisma 6.19 to 7.10.1 and hit five problems, in this order: P1012 for `url` in schema.prisma, a stale client failing on runtime/library.js, PrismaConfigEnvError because .env is no longer auto-loaded, PrismaClientInitializationError because a driver adapter is now required, and a SQLite file:./dev.db URL that silently resolved to a new, empty database. Below are the exact errors and fixes.

Upgrading a Prisma 6.19 SQLite app to Prisma 7.10.1 breaks in five ways. url = env(...) is rejected in schema.prisma (P1012), and the connection URL moves to prisma.config.ts. That file doesn't load .env by itself. PrismaClient now needs a driver adapter. Most dangerous of all, file:./dev.db is now resolved relative to the project root rather than the prisma/ folder, so the app silently starts against a new, empty database.

> Note (checked 2026-12-01): npm's latest tag for prisma now points to 8.0.0-rc.36, a release candidate, so a bare npm i prisma installs Prisma 8 RC, not 7. To follow this post, pin prisma@7.10.1 @prisma/client@7.10.1.

Environment

  • prisma / @prisma/client 6.19.0 → 7.10.1, @prisma/adapter-better-sqlite3 7.10.1, dotenv 17.4.2
  • Node v22.23.3 (CommonJS), Docker node:22, reproduced 2026-11-30
  • The app has User/Post models with a relation, a .env containing DATABASE_URL="file:./dev.db", and an index.js that seeds data and runs a nested findMany and a count. On 6.19 it runs with prisma db push && node index.js (repro/01-prisma6-baseline.log).

The upgrade was npm i prisma@7.10.1 @prisma/client@7.10.1, then prisma generate, prisma db push, node index.js.

1. Prisma 7: P1012 "The datasource property `url` is no longer supported in schema files"

log
Error code: P1012error: The datasource property `url` is no longer supported in schema files. Move connection URLs for Migrate to `prisma.config.ts` and pass either `adapter` for a direct database connection or `accelerateUrl` for Accelerate to the `PrismaClient` constructor.  -->  prisma/schema.prisma:7

Both prisma generate and prisma db push fail with this error. Fix: remove url from the datasource block, leaving only provider = "sqlite", and create prisma.config.ts (see issue 3 for the version that works).

2. Prisma 7: "Cannot find module '/app/node_modules/@prisma/client/runtime/library.js'"

log
Error: Cannot find module '/app/node_modules/@prisma/client/runtime/library.js'  code: 'MODULE_NOT_FOUND',

Because generate failed, node_modules still held the client generated by Prisma 6. It imports a runtime file that @prisma/client@7 no longer ships. This is a follow-on error: fix the schema and re-run prisma generate. Don't start debugging module resolution.

3. Prisma 7: "PrismaConfigEnvError: Cannot resolve environment variable: DATABASE_URL"

The obvious port of the old schema line:

ts
import { defineConfig, env } from "prisma/config";export default defineConfig({ schema: "prisma/schema.prisma", datasource: { url: env("DATABASE_URL") } });

fails even though .env sits right next to it:

log
Failed to load config file "/app" as a TypeScript/JavaScript module. Error: PrismaConfigEnvError: Cannot resolve environment variable: DATABASE_URL.

Prisma 7 does not load .env for you; Prisma 6 did, as shown by Environment variables loaded from .env in the baseline log. Fix: npm i dotenv and put import "dotenv/config"; at the top of prisma.config.ts. After that, generate and db push succeed (repro/04-after-dotenv.log).

4. Prisma 7: "PrismaClient was instantiated without any options. A driver adapter is required"

log
PrismaClientInitializationError: PrismaClient was instantiated without any options. A driver adapter is required to connect to your database.

This happens with prisma-client-js and require('@prisma/client') too, not only the new prisma-client generator. Prisma 7 connects through JS driver adapters. For SQLite:

js
require('dotenv/config');const { PrismaClient } = require('@prisma/client');const { PrismaBetterSqlite3 } = require('@prisma/adapter-better-sqlite3');const prisma = new PrismaClient({ adapter: new PrismaBetterSqlite3({ url: process.env.DATABASE_URL }) });

npm i @prisma/adapter-better-sqlite3@7.10.1 took about 4 s on node:22, which points to a prebuilt better-sqlite3 binary rather than a source build. Slim or Alpine images may need build tools. After this, index.js printed the same output as on Prisma 6 (05-after-adapter.log).

5. Prisma 7: SQLite `file:./dev.db` now points at a different file (silent)

There was no error, but the data was gone. With Prisma 6, file:./dev.db was resolved relative to prisma/schema.prisma, so the database lived at prisma/dev.db. With the URL in prisma.config.ts, both db push and the adapter resolved it relative to the project root, where the config lives and where the commands ran, so Prisma 7 created a new `./dev.db` and the app used it:

log
prisma/dev.db -> users: [{"id":1,"email":"ada@example.com"},{"id":2,"email":"pre-upgrade@example.com"}]dev.db -> users: [{"id":1,"email":"ada@example.com"}]

(repro/06-sqlite-path-moved.log. The pre-upgrade@example.com row exists only in the old file.) Fix: point at the existing file explicitly: DATABASE_URL="file:./prisma/dev.db". After the change, db push reports SQLite database "dev.db" at "file:./prisma/dev.db", no ./dev.db is created, and new IDs continue from the old data (07-prisma7-final.log).

What didn't work

  • prisma.config.ts with env("DATABASE_URL") but no dotenv import (issue 3).
  • Running the app before a successful prisma generate, which gives the misleading runtime/library.js error (issue 2).
  • Keeping new PrismaClient() with no arguments (issue 4).

Final working setup

log
prisma@7.10.1  @prisma/client@7.10.1  @prisma/adapter-better-sqlite3@7.10.1  dotenv@17.4.2   (Node 22)
  • .env: DATABASE_URL="file:./prisma/dev.db"
  • schema.prisma: datasource db { provider = "sqlite" }, with the generator left as prisma-client-js
  • prisma.config.ts: import "dotenv/config" plus defineConfig({ schema: "prisma/schema.prisma", datasource: { url: env("DATABASE_URL") } })
  • index.js: new PrismaClient({ adapter: new PrismaBetterSqlite3({ url: process.env.DATABASE_URL }) })

The full files are in repro/app/, and the Prisma 6 original is in repro/app.prisma6-snapshot/.

Sources

  • Upgrade guide to Prisma 7: https://www.prisma.io/docs/orm/more/upgrade-guides/upgrading-versions/upgrading-to-prisma-7
  • Datasource config in prisma.config.ts (linked from the P1012 message): https://pris.ly/d/config-datasource
  • Client constructor and driver adapters: https://pris.ly/d/prisma7-client-config, https://pris.ly/d/driver-adapters

Connected posts