Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`prisma format` remembers old columns/relations and re-adds them

Open
#252 0 comments 0 reactions 0 assignees View on GitHub

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
Domain
cli, database, tooling

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from prisma/prisma-cli

All issues in prisma/prisma-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.