-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Prisma 7.4 Partial Indexes are bugged during migrations #29263
Copy link
Copy link
Closed
prisma/prisma-engines
#5795Closed
Copy link
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.