Skip to content

fix: fix partial index added diff#5795

Merged
jacek-prisma merged 3 commits intomainfrom
fix/fix-partial-index-added-diff
Mar 11, 2026
Merged

fix: fix partial index added diff#5795
jacek-prisma merged 3 commits intomainfrom
fix/fix-partial-index-added-diff

Conversation

@jacek-prisma
Copy link
Copy Markdown
Contributor

@jacek-prisma jacek-prisma commented Mar 10, 2026

TML-2063

Fixes prisma/prisma#29263

Summary by CodeRabbit

  • Bug Fixes

    • Fixed migration diff detection for partial indexes so manual partial indexes are ignored when the preview feature is not enabled, preventing false positives when comparing schemas and migrations.
  • Tests

    • Added tests to validate that manual partial indexes without the preview feature do not produce migration differences.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d64e16c5-410d-4db5-ac0d-b07c9ac8a54f

📥 Commits

Reviewing files that changed from the base of the PR and between a188d7d and 27542a6.

📒 Files selected for processing (1)
  • schema-engine/sql-migration-tests/tests/migrations/diff.rs

Walkthrough

Added a guard to index-diff logic to exclude stripped partial indexes from being treated as newly created, and added tests (and minor test string literal refactors) to ensure manually-created partial indexes are ignored when the partialIndexes preview feature is not enabled.

Changes

Cohort / File(s) Summary
SQL Schema Connector
schema-engine/connectors/sql-schema-connector/src/sql_schema_differ/table.rs
Added an extra guard (&& !next_index.is_stripped_partial()) when identifying created indexes so stripped partial indexes are not considered newly created.
SQL Migration Tests
schema-engine/sql-migration-tests/tests/migrations/diff.rs
Replaced multi-line SQL string literals with raw string literals and added test(s) from_schema_datamodel_to_migrations_ignores_manual_partial_indexes_without_preview_feature (Postgres, exclude CockroachDb) to assert manual partial indexes are ignored without the preview feature.
Manifest
Cargo.toml
Small manifest changes (tests/build context) reflected by line edits.

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: fix partial index added diff' directly addresses the issue being fixed: partial indexes causing repeated drop/create migrations. It accurately summarizes the main change.
Linked Issues check ✅ Passed The PR adds a guard condition to prevent stripped partial indexes from being considered newly created, and includes tests verifying partial indexes are ignored without preview feature, directly addressing the repeated migration issue in #29263.
Out of Scope Changes check ✅ Passed All changes in the PR are directly scoped to fixing the partial index diff issue: the guard condition in table.rs, test updates, and new test cases all relate to partial index handling without unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/fix-partial-index-added-diff

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 10, 2026

Merging this PR will not alter performance

✅ 11 untouched benchmarks
⏩ 11 skipped benchmarks1


Comparing fix/fix-partial-index-added-diff (27542a6) with main (d684c19)

Open in CodSpeed

Footnotes

  1. 11 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 10, 2026

Wasm Query Compiler File Size

Engine This PR Base branch Diff
Postgres 3.505MiB 3.505MiB 0.000B
Postgres (gzip) 1.142MiB 1.142MiB 0.000B
Postgres (size-optimized) 1.766MiB 1.766MiB 0.000B
Postgres (size-optimized, gzip) 695.000KiB 694.907KiB 95.000B
Mysql 3.458MiB 3.458MiB 0.000B
Mysql (gzip) 1.127MiB 1.127MiB 0.000B
Mysql (size-optimized) 1.736MiB 1.736MiB 0.000B
Mysql (size-optimized, gzip) 684.143KiB 684.227KiB -86.000B
Sqlite 3.376MiB 3.376MiB 0.000B
Sqlite (gzip) 1.098MiB 1.098MiB 0.000B
Sqlite (size-optimized) 1.692MiB 1.692MiB 0.000B
Sqlite (size-optimized, gzip) 667.295KiB 667.292KiB 3.000B
SQL Server 3.598MiB 3.598MiB 0.000B
SQL Server (gzip) 1.162MiB 1.162MiB 2.000B
SQL Server (size-optimized) 1.766MiB 1.766MiB 0.000B
SQL Server (size-optimized, gzip) 698.659KiB 698.659KiB 0.000B
CockroachDB 3.555MiB 3.555MiB 0.000B
CockroachDB (gzip) 1.160MiB 1.160MiB 1.000B
CockroachDB (size-optimized) 1.791MiB 1.791MiB 0.000B
CockroachDB (size-optimized, gzip) 705.235KiB 705.227KiB 8.000B

Copy link
Copy Markdown
Member

@aqrln aqrln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with a nit

@jacek-prisma jacek-prisma merged commit 280c870 into main Mar 11, 2026
98 of 99 checks passed
@jacek-prisma jacek-prisma deleted the fix/fix-partial-index-added-diff branch March 11, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prisma 7.4 Partial Indexes are bugged during migrations

2 participants