Goodbye Prisma
The straw that broke the camel's back, and why I am saying goodbye to one of the most important libraries in my web stack
- date:
I’ve been using Prisma since I first made Starboard in September 2024. I loved it so much! It has been a core part of all of my web-based projects since then. Today, I am saying goodbye to it and ripping it out of my web app templates, and eventually, everything else I wrote using it.
Early Days
I started with Prisma 5 when I was writing Starboard, back then the Prisma Engine was in Rust and I remember having a lot of issues getting it to work in a containerised fashion. Even then, I loved it for a number of reasons.
A Beautiful DSL
Prisma’s Domain-Specific Language for defining the database is truly one of the best I have ever used, and is why I fell in love with it to begin with.
Here’s how you define a table in the DB (assuming you’re using Postgres):
model game {
id Int @id @default(0)
name String @default("Starboard")
subtitle String @default("Star Harder")
active Boolean @default(false)
showInstagram Boolean @default(true)
shopEnabled Boolean @default(true)
tasksEnabled Boolean @default(true)
scoreboardEnabled Boolean @default(true)
}
It even made complex relationships super easy:
model Storage {
id String @id @default(cuid())
name String
image String?
roomId String
storageTypeTypeId String
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
isDeleted Boolean @default(false)
Asset Asset[]
kits Kit[]
storageActions StorageAction[]
StorageOnGroups StorageOnGroups[]
room Room @relation(fields: [roomId], references: [id])
type StorageType @relation(fields: [storageTypeTypeId], references: [id])
@@index([roomId])
@@index([storageTypeTypeId])
}Stupid Simple Consumption
Using Prisma was incredibly easy. Since it used TypeScript, the entire DB would be typed and it made CRUD operations genuinely enjoyable.
await prisma.tasks.create({
data: {
title: String(name),
description: String(description),
reward: parseInt(stars),
active: checked
}
});Version Controlling DB State
When you updated the state of the Database, it would store the SQL file in the prisma/migrations directory. This meant that if you had to do manual data migration to have it properly stored in the new state, you’d be able to add it there, and when the new system was deployed it would be handled automatically. I LOVED this. This saved me so many headaches during complete DB rewrites.
These would then be run sequentially so, in theory it didn’t matter how old your deployment was, it would take the migration in stride and continue on as if nothing happened. Seamless!
Enter: Prisma 7
This is when I started falling out of love with Prisma as a package. I actually had no issue at all with Prisma removing the Rust engine. This actually made it easier for me to develop on my NixOS PC (because NixOS is weird and has issues sometimes).
Infact, my biggest issue was this brand new prisma.config.ts file which I still believe is entirely unnecessary. Prisma has its own DSL already, why does this require a separate file for configurations when all of the values and keys are strings or booleans?
export declare type PrismaConfig = {
// Whether features with an unstable API are enabled.
experimental: {
externalTables: boolean;
};
// The path to the schema file, or path to a folder that shall be recursively searched for *.prisma files.
schema?: string;
// Configuration for Prisma migrations.
migrations?: {
path: string;
seed: string;
initShadowDb: string;
};
// Configuration for the database view entities.
views?: {
path: string;
};
// Configuration for the `typedSql` preview feature.
typedSql?: {
path: string;
};
// Database connection configuration
datasource?: {
url: string;
shadowDatabaseUrl?: string;
};
};This caused me a huge headache and some of my favourite projects I’ve written are still written in Prisma 5 or 6, even though those have vulnerabilities!
Enter: Prisma 8
I’m currently working on a companion Web Application to make playing JetLag: The Game easier. As I was setting up the DB from my SvelteKit, Database & Authentication template, I got the following error.
× [CLI.V7_COMMAND] `prisma migrate dev` is a Prisma 7 command and is not available in Prisma 8
why: Prisma 8 emits the contract, plans the migration and applies it in separate steps:
run `contract emit`,
then `migration status`,
which prints the migration plan that plans it from where the database is,
and run that plan,
fill in any placeholders it leaves and run the `node` command it prints (for `--create-only`, stop here),
then `db migrate`.
When migrations on disk already lead to the new contract, `migration status` prints no plan,
and `db migrate` applies them.
For a database that is not empty and that Prisma 8 has not signed,
`migration status` also says how to adopt it with `db sign`,
which comes before `db migrate`.
While Prisma 7 still owns this project's migrations,
install its CLI with `npm install --save-dev @prisma/prisma7@7` and run `prisma7 migrate dev` instead.
→ Step 1: prisma contract emit
Step 2: prisma migration status
Step 3: prisma db migrate
Read its help: prisma contract emit --helpnpx prisma migrate dev
I slightly understand why they made this change. HOWEVER, the standard workflow for Pre-Prisma 8 work was to use npx prisma migrate dev, and since Prisma 8′s Release Candidate is now published as an npm package, I got this INCREDIBLY infurating error message that is not my fault and instead the fault of Prisma itself.
THIS was the straw that broke the camel’s back for me. I grumbled but put up with prisma.config.ts because while annoying, it wasn’t really massively infurating (Despite the fact Prisma 7 also no longer had the Prisma Client generated in its node_module directory which broke my everything for a while…)
Prisma’s reasonings seem to be to make migrations more robust, and to make it easier for AI agents to do these changes. These are somewhat noble causes, sure, but again, the former workflow is now broken due to the release-candidate package’s release. I now need to either:
- Never update or redeploy any project that uses Prisma ever again
- Go in and modify every project that uses Prisma and explicitly tie it to a certain Prisma version.
Some of you might be saying “Oh but that’s an ‘issYOU’ and not an ‘issPRISMA’. To you, I say look at Prisma’s Docs on initial migrations! This command does not say to tie to a specific package version!
This is an ‘issPRISMA’, and is bullshit laziness on their part in my opinion.
In fact, this is such a short-sighted thing that I will no longer support or recommend Prisma to anyone I speak to. Instead, I will warn people away from Prisma when they get into Web Application development because this is just so dumb.
What Will I Do Now?
I now have to put my JetLag: The Game web app on pause while I rebuild my SvelteKit & DB and SvelteKit, DB & Auth templates away from Prisma and to something else. It seems like Drizzle is going to be its successor. I’ve tried Drizzle once, and I thought it was okay.
But I will HAPPILY take it over risking Prisma’s core team decided to do more stupid changes that break workflows.
Oh, also. Prisma, your new logo is ugly, Bring back the triangle! It’s not even reminiscent of a prism anymore, and Overnice Studio, who created the original Prisma Logo, were incredibly proud of it making its way to Times Square. And they should be, it’s a great brand identity! (I love brand identities, I think they’re so important. In fact, you can see mine here.)
Have some cop on, Prisma. This fumble is generational, and I haven’t been this frustrated about software since Windows 11.