fix: correct index mapping in electric_power_quality_summaries table#44
Merged
Conversation
Fix incorrect index mapping where idx_epqs_summary_interval_start was indexing the 'id' column instead of the 'summary_interval_start' column. This issue was introduced when uuid columns were removed and replaced with id PRIMARY KEY columns. The index name suggests it should index summary_interval_start, not id. Changes: - V3 migration: Change idx_epqs_summary_interval_start to index summary_interval_start column instead of id column Testing: - All H2 repository tests passing (60+ tests) - Flyway migrations V1, V2, V3 execute successfully - Index now correctly targets summary_interval_start column Fixes issue identified in commit d5e321b where uuid index removal inadvertently created an incorrectly mapped index. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes incorrect index mapping in the
electric_power_quality_summariestable whereidx_epqs_summary_interval_startwas indexing theidcolumn instead of thesummary_interval_startcolumn.Root Cause
This issue was introduced in commit d5e321b when uuid columns were removed and replaced with id PRIMARY KEY columns. During the migration, one index was incorrectly remapped:
Before (incorrect):
After uuid removal (still incorrect):
Fixed (correct):
Changes
openespi-common/src/main/resources/db/migration/V3__Create_additiional_Base_Tables.sqlsummary_interval_startcolumnAnalysis of UUID Index Removals
Commit d5e321b removed 25 uuid indexes across V1 and V3 migrations:
id CHAR(36) PRIMARY KEYwhich automatically creates an indexidx_epqs_summary_interval_startwas indexing wrong columnTesting
summary_interval_startcolumnImpact
Queries filtering by
summary_interval_startwill now properly use this index for improved performance.Related Issues
TestContainers Issue (not addressed in this PR):
🤖 Generated with Claude Code