Skip to content

add missing indexes on all foreign keys#820

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

add missing indexes on all foreign keys#820
EtienneLt wants to merge 6 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

Review limit reached

@EtienneLt, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 4 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab4759f1-f882-4d8c-97e3-f600f3de8d5e

📥 Commits

Reviewing files that changed from the base of the PR and between 48f6e27 and 071c206.

📒 Files selected for processing (3)
  • src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/ByFilterDeletionEntity.java
  • src/main/resources/db/changelog/changesets/changelog_20260528T130000Z.xml
  • src/main/resources/db/changelog/db.changelog-master.yaml
📝 Walkthrough

Walkthrough

This PR adds database indexes to nine JPA entities and their collection/join tables via @Index annotations, then provides Liquibase createIndex changesets to apply those indexes to the database schema.

Changes

Database index optimization

Layer / File(s) Summary
JPA entity and collection/join 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
Multiple entity classes declare database indexes via @Table, @CollectionTable, and @JoinTable annotations: LimitsForLineTypeEntity adds line_type_id index; converter station creation/modification entities add indexes on reactive capability curve collection tables; CreateVoltageLevelTopologyEntity indexes its switch kinds collection; LCC converter station entities index shunt compensators; ByFilterDeletionEntity indexes the filters join table; LimitsPropertyEntity adds operational_limit_group_id index; MoveVoltageLevelFeederBaysEntity indexes the move feeder bay collection; VariationFilterEntity adds assignment_id index alongside existing formula_id index.
Liquibase 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 nine createIndex changeSets that create non-unique indexes on the table columns corresponding to the JPA entity declarations; the master changelog YAML registers the new changelog file for processing.

Suggested reviewers

  • etiennehomer
  • flomillot
🚥 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/missing, containing only a template comment without any actual content describing the changeset. Provide a meaningful description explaining the motivation, affected tables, and expected performance improvements from adding these indexes.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'add missing indexes on all foreign keys' accurately summarizes the main change: adding database indexes to foreign key columns across multiple JPA entities and database tables.
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 Outdated
EtienneLt added 3 commits May 26, 2026 11:27
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@JoinTable(
name = "byFilterDeletionFilters",
joinColumns = @JoinColumn(name = "id"), foreignKey = @ForeignKey(name = "by_filter_deletion_id_fk"),
indexes = @Index(name = "by_filter_deletion_filters_id_idx", columnList = "id"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add the another foreign key

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

Signed-off-by: Etienne LESOT <etienne.lesot@rte-france.com>
@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.

2 participants