Skip to content

add missing indexes on all foreign keys#820

Open
EtienneLt wants to merge 2 commits into
mainfrom
add-other-missing-index
Open

add missing indexes on all foreign keys#820
EtienneLt wants to merge 2 commits into
mainfrom
add-other-missing-index

Conversation

@EtienneLt
Copy link
Copy Markdown
Contributor

PR Summary

Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@EtienneLt EtienneLt self-assigned this May 22, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Review Change Stack

Warning

Rate limit exceeded

@EtienneLt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 39 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b08702d5-f068-4f0e-881c-1a3092ea3512

📥 Commits

Reviewing files that changed from the base of the PR and between e3d6851 and d38d75e.

📒 Files selected for processing (1)
  • src/main/resources/db/changelog/changesets/changelog_20260522T143544Z.xml
📝 Walkthrough

Walkthrough

This pull request adds database indexes to optimize query performance across multiple JPA entities. The changes include Maven build configuration updates to pin Liquibase version 4.31.1, JPA entity annotation updates to declare indexes on collection tables and join tables, and a corresponding Liquibase database migration to create those indexes in the schema.

Changes

Database index optimization

Layer / File(s) Summary
Build configuration and Liquibase version
pom.xml
Project version downgraded from 2.36.0-SNAPSHOT to 2.35.0-SNAPSHOT; Liquibase version property 4.31.1 added to Maven properties.
JPA entity index declarations
src/main/java/org/gridsuite/modification/server/entities/catalog/LimitsForLineTypeEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/creation/CreateVoltageLevelTopologyEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LccConverterStationCreationEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/ByFilterDeletionEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LccConverterStationModificationEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LimitsPropertyEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/modification/MoveVoltageLevelFeederBaysEntity.java, src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VariationFilterEntity.java
Eleven entity files updated with explicit index declarations: @Table indexes added to LimitsForLineTypeEntity, LimitsPropertyEntity, and VariationFilterEntity (including dual indexes on VariationFilterEntity); @CollectionTable indexes added to seven creation and modification entities; @JoinTable index added to ByFilterDeletionEntity.
Database migration changelog
src/main/resources/db/changelog/changesets/changelog_20260522T143544Z.xml, src/main/resources/db/changelog/db.changelog-master.yaml
New Liquibase changelog XML defines createIndex operations for all declared indexes across tables including variation_filter, by_filter_deletion_filters, converter_station_creation_rcc_points, converter_station_modification_rcc_points, create_voltage_level_topology_switch_kinds, limits_for_line_type, limits_property, and move_feeder_bay; master changelog YAML updated to include the new migration file.

Suggested reviewers

  • etiennehomer
  • SlimaneAmar
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description is empty, providing no context or details about the changes despite the non-trivial nature of the changeset. Add a description explaining what indexes were added, why they improve performance, and which tables/foreign keys are affected.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changeset objective: adding database indexes on foreign keys across multiple JPA entities and the corresponding Liquibase migration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/resources/db/changelog/changesets/changelog_20260522T143544Z.xml (1)

3-6: ⚡ Quick win

Align index naming with entity mapping to avoid schema drift.

Line 4 uses VariationFilter_assignment_id_idx, while the entity mapping uses variation_filter_assignment_id_idx. Keep a single canonical name across JPA and Liquibase.

Proposed fix
-        <createIndex indexName="VariationFilter_assignment_id_idx" tableName="variation_filter">
+        <createIndex indexName="variation_filter_assignment_id_idx" tableName="variation_filter">
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/resources/db/changelog/changesets/changelog_20260522T143544Z.xml`
around lines 3 - 6, The Liquibase changeSet with id "1779460567128-3" creates an
index named "VariationFilter_assignment_id_idx" on table "variation_filter" for
column "assignment_id" which does not match the JPA/entity index name
"variation_filter_assignment_id_idx"; rename the index in this changeSet to
"variation_filter_assignment_id_idx" so the created index name aligns with the
entity mapping and prevents schema drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pom.xml`:
- Line 24: The pom.xml's <version> element was changed to "2.35.0-SNAPSHOT"
which looks like an accidental rollback unrelated to this indexing PR; either
confirm this version bump is intentional or revert the <version> value to the
previous snapshot/release value used before the change (restore the prior
version string), and if intentional, add a short commit message or PR note
explaining why the module version was modified.

---

Nitpick comments:
In `@src/main/resources/db/changelog/changesets/changelog_20260522T143544Z.xml`:
- Around line 3-6: The Liquibase changeSet with id "1779460567128-3" creates an
index named "VariationFilter_assignment_id_idx" on table "variation_filter" for
column "assignment_id" which does not match the JPA/entity index name
"variation_filter_assignment_id_idx"; rename the index in this changeSet to
"variation_filter_assignment_id_idx" so the created index name aligns with the
entity mapping and prevents schema drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 17820fa5-9d01-4930-b7f3-db8ffd8e0125

📥 Commits

Reviewing files that changed from the base of the PR and between 33db2f2 and e3d6851.

📒 Files selected for processing (13)
  • pom.xml
  • src/main/java/org/gridsuite/modification/server/entities/catalog/LimitsForLineTypeEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/creation/CreateVoltageLevelTopologyEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LccConverterStationCreationEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/ByFilterDeletionEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LccConverterStationModificationEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LimitsPropertyEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/modification/MoveVoltageLevelFeederBaysEntity.java
  • src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VariationFilterEntity.java
  • src/main/resources/db/changelog/changesets/changelog_20260522T143544Z.xml
  • src/main/resources/db/changelog/db.changelog-master.yaml

Comment thread pom.xml
<groupId>org.gridsuite</groupId>
<artifactId>gridsuite-network-modification-server</artifactId>
<version>2.36.0-SNAPSHOT</version>
<version>2.35.0-SNAPSHOT</version>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Potentially accidental project version rollback

Line 24 sets the module version to 2.35.0-SNAPSHOT, which appears unrelated to this indexing PR and can disrupt expected snapshot progression if unintended. Please confirm or revert.

Suggested correction
-    <version>2.35.0-SNAPSHOT</version>
+    <version>2.36.0-SNAPSHOT</version>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<version>2.35.0-SNAPSHOT</version>
<version>2.36.0-SNAPSHOT</version>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pom.xml` at line 24, The pom.xml's <version> element was changed to
"2.35.0-SNAPSHOT" which looks like an accidental rollback unrelated to this
indexing PR; either confirm this version bump is intentional or revert the
<version> value to the previous snapshot/release value used before the change
(restore the prior version string), and if intentional, add a short commit
message or PR note explaining why the module version was modified.

@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant