Skip to content

Prisma 7.4 Partial Indexes are bugged during migrations #29263

@brian-lou

Description

@brian-lou

Bug description

I'm using "partialIndexes" as previewFeatures in my prisma schema, and have a few postgres partial indexes.

For example,

  @@unique([project_id], where: { default_branch: true }, map: "unique_default_branch_per_project")

I've already applied the corresponding migration to my db; however, when I try to run any prisma migrate dev --name "some_other_migration", prisma will also drop and re-generate the corresponding partial indexes on the db:

/*
  Warnings:

  - A unique constraint covering the columns `[project_id]` on the table `branches` will be added. If there are existing duplicate values, this will fail.

*/
-- DropIndex
DROP INDEX "unique_default_branch_per_project";

-- CreateIndex
CREATE UNIQUE INDEX "unique_default_branch_per_project" ON "branches"("project_id") WHERE ("default_branch" = true);

This happens every time I run prisma migrate dev --name

Severity

🔹 Minor: Unexpected behavior, but does not block development

Reproduction

Create a partial index on a table, and then run prisma migrate dev --name <any_string> a few times.

Expected vs. Actual Behavior

Duplicate migrations should not be created.

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

Kind of - previous versions didn't support previewFeatures

Workaround

No

Prisma Schema & Queries

  @@unique([project_id], where: { default_branch: true }, map: "unique_default_branch_per_project")

Prisma Config

generator client {
  provider = "prisma-client"
  output   = "../../src/generated"
  previewFeatures = ["typedSql", "partialIndexes"]
  moduleFormat = "esm"
  compilerBuild = "fast" // default to fast
}

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS: macOs
  • Database: PostgreSQL
  • Node.js version: v24.13.0

Prisma Version

7.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions