`prisma format` remembers old columns/relations and re-adds them
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
Research direction
Reproduce the issue with the shown schema.prisma and prisma format, then compare the result after deleting the local prisma/migrations/2026...my_migration folder. Start by locating the prisma format entry point and its schema or migration state handling. Done means deleted relations and columns stay absent after formatting, including for models not yet present in the database.
Written by the indexing model from the issue text.
Description
Summary
When I run prisma format, it doesn't just format my schema.prisma file, it also adds columns and relations which I've recently deleted.
Scenario
I have the following model:
model foobars {
id BigInt @id @default(autoincrement())
name String @db.Text
lorem_ipsu String @db.Text
lorem String @db.Text
description String? @db.Text
@@schema("foo")
}
When I run prisma format, it becomes the following (for the sake of brevity, I won't paste the related models here):
model foobars {
id BigInt @id @default(autoincrement())
name String @db.Text
lorem_ipsu String @db.Text
lorem String @db.Text
description String? @db.Text
amets amets? @relation(fields: [ametsId], references: [id])
ametsId BigInt?
dolores options? @relation(fields: [doloresId], references: [id])
doloresId Int?
ipsums ipsums? @relation(fields: [ipsumsId], references: [id])
ipsumsId Int?
@@schema("foo")
}
All the relations and columns added by Prisma used to exist on the model, but I've deleted them.
Note that those are all new models which don't exist in my actual database yet.
One non-standard thing I've done which might have had some impact is that I had created the migration locally with prisma migrate dev --create-only --name my-migration, didn't apply it, then deleted the prisma/migrations/2026...my_migration folder so that I could work some more on my migration then generate a new file.
This may be the same issue as https://github.com/prisma/language-tools/issues/1800
Version
Prisma 7.8.0
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 2
- Avg merge
- 13h 3m
- Merged PRs (30d)
- 41
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from prisma/prisma-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
prisma/prisma-cli#309 · 1 comment ·
Maintainers usually reply within 1 day
-
The update notice tells users to install @prisma/cli and does not recognise a global prisma installOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
prisma/prisma-cli#306 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
prisma/prisma-cli#305 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
prisma/prisma-cli#302 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
prisma/prisma-cli#300 ·
Maintainers usually reply within 1 day
All issues in prisma/prisma-cli
Similar issues
-
bug HemiStake
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
hemilabs/ui-monorepo#2413 ·
Maintainers usually reply within 1 day
-
component/ui framework/react kind/bug language/javascript
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
meshery/meshery#22216 · 3 comments ·
Maintainers usually reply within 1 day
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
paperclipai/paperclip#14982 ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
lingdojo/kana-dojo#31515 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day