chore(panel): Prisma 7, whose client is source and whose URL is the panel's - #130
Merged
Conversation
…anel's
Prisma 7 removes the Rust query engine. The client it generates is now
ordinary TypeScript that talks to the database through a driver adapter,
which changes three things the panel relied on, none of them optional.
**The client is generated into the source tree** — `src/generated/prisma`
— and compiled with everything else, so `@prisma/client` is no longer an
import path. Twenty files importing a relative path is twenty files to
edit the day that directory moves, so they all go through
`src/prisma/client.ts`; the schema and that file are the only two places
that name the location. It is not committed: `prisma generate` rebuilds
it on `postinstall`, as the installer and `docs/updating.md` already did.
**The connection belongs to the panel now.** The schema may no longer
carry `url = env("DATABASE_URL")`; Prisma refuses to load a schema that
does. `PrismaService` builds a `PrismaPg` adapter from the configuration
it is injected, so `DATABASE_URL` has exactly one reader, and it is no
longer `.optional()` in the environment schema — a missing one used to
surface as a Prisma error in the middle of somebody's first request, and
now stops the boot.
**The CLI is configured by `prisma.config.ts`**, since neither the
`prisma` key in package.json nor the automatic `.env` loading survives.
The datasource URL is read there with `process.env` rather than Prisma's
`env()` helper, which throws while the file is being loaded — before the
command is even known. `prisma generate` needs no database, and the
installer runs it during the build, several steps before it writes
`.env`: an eager `env()` there fails every fresh installation on a
variable that command was never going to use. Absent, the key is left
out, and `migrate deploy` says for itself that it wants one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiQhbiTpvjFnK7CJcJuR9m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prisma 6.19.3 → 7.10.0. C'est la majeure que
.github/dependabot.ymlmet explicitement de côté (« major bumps of these land through a deliberate migration, never through an automated pull request ») : Prisma 7 retire le moteur de requêtes Rust, et le client qu'il génère est désormais du TypeScript ordinaire qui parle à la base via un driver adapter. Trois choses sur lesquelles le panel s'appuyait changent, aucune facultative.Le client est généré dans les sources
Dans
src/generated/prisma, compilé avec le reste — donc@prisma/clientn'est plus un chemin d'import. Vingt fichiers pointant un chemin relatif, ce sont vingt fichiers à rouvrir le jour où ce répertoire bouge : ils passent tous parsrc/prisma/client.ts, et le schéma plus ce fichier sont les deux seuls endroits qui nomment l'emplacement.Le répertoire n'est pas commité :
prisma generatele refait à chaquepostinstall, ce que l'installeur etdocs/updating.mdfaisaient déjà.La connexion appartient au panel
Le schéma n'a plus le droit de porter
url = env("DATABASE_URL")— Prisma refuse de charger un schéma qui le fait.PrismaServiceconstruit donc un adaptateurPrismaPgà partir de la configuration qu'on lui injecte :DATABASE_URLn'a plus qu'un seul lecteur, et il n'est plus.optional()dans le schéma d'environnement. Une variable manquante remontait jusque-là comme une erreur Prisma au milieu de la première requête de quelqu'un ; elle arrête maintenant le démarrage.La CLI est configurée par
prisma.config.tsNi la clé
prismadu package.json ni le chargement automatique de.envne survivent à la majeure.L'URL y est lue avec
process.envplutôt qu'avec le helperenv()de Prisma, et c'est délibéré :env()lève pendant le chargement du fichier de configuration, donc avant même que la commande soit connue. Orprisma generaten'a besoin d'aucune base, et l'installeur le lance pendant l'étape Build — plusieurs étapes avant d'écrire.env. Unenv()impatient à cet endroit fait échouer toute installation neuve sur une variable que la commande n'allait jamais utiliser. Absente, la clé est simplement omise, etmigrate deployréclame lui-même ce qui lui manque :Vérifié en local
pnpm install --frozen-lockfiledepuis unsrc/generatedsupprimé (le client est bien refait par le postinstall),format:check,lint7/7,typecheck7/7,build5/5,test7/7 — 897 tests.Ce que les tests unitaires ne couvrent pas : ils bouchonnent Prisma, donc aucun d'eux n'ouvre de connexion. Le chemin réel —
migrate deploy,db seed, puis un panel qui démarre sur l'adaptateur — est éprouvé par le job Installer, qui installe de bout en bout et crée un serveur. C'est lui qu'il faut regarder sur cette PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01HiQhbiTpvjFnK7CJcJuR9m