Skip to content

feat(mysql): visible/invisible index management for MySQL 8.0+ - #2606

Merged
openai0229 merged 12 commits into
OtterMind:mainfrom
Aias00:feature/mysql-invisible-index-2574
Sep 2, 2026
Merged

openai0229 merged 12 commits into
OtterMind:mainfrom
Aias00:feature/mysql-invisible-index-2574

Conversation

@Aias00

@Aias00 Aias00 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add visible field to TableIndex domain model and read the Visible column from MySQL SHOW INDEXES (8.0+)
  • Generate INVISIBLE keyword in index DDL via MysqlIndexTypeEnum.buildIndexScript(); add buildAlterIndexVisibility() for the ALTER INDEX ... VISIBLE|INVISIBLE path
  • Frontend: add a "Visible" column to the index editor with a VISIBLE/INVISIBLE toggle, disabled for primary keys, gated to MySQL

Closes #2574

Test plan

  • MySQL 8.0+: open a table with indexes — verify VISIBLE/INVISIBLE state is shown
  • Toggle an index from VISIBLE to INVISIBLE — verify SQL preview includes ALTER INDEX ... INVISIBLE
  • Verify primary key row does not offer a visibility toggle
  • MySQL 5.7: verify the visibility column does not appear
  • mvn -B compile passes for the MySQL plugin module
  • eslint passes with zero warnings

@Aias00
Aias00 requested a review from openai0229 as a code owner August 5, 2026 13:46
Copilot AI lite review requested due to automatic review settings August 5, 2026 13:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@openai0229

openai0229 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up review: changes requested before merge.

P1: the visibility-only fast path is incomplete. onlyIndexVisibilityChanged() does not compare index method and other index attributes such as prefix length, so an edit that changes visibility together with another index property can be classified as visibility-only and silently omit the other DDL. Please compare the complete index definition (or remove this optimization), add regression tests for mixed visibility/method/prefix changes.

Aias00 added 5 commits August 21, 2026 02:36
Add `visible` field to TableIndex domain model, read the `Visible` column
from SHOW INDEXES in MySQL metadata, generate INVISIBLE keyword in index
DDL, and add buildAlterIndexVisibility for ALTER INDEX syntax.

Frontend: add a "Visible" column to the index editor with a
VISIBLE/INVISIBLE toggle, disabled for primary keys, gated to MySQL only.

Test fixtures: init.sql, grants.sql, cleanup.sql, README.md under
script/test-fixtures/mysql/MYSQL-OBJ-006/.

Closes OtterMind#2574
Replace hardcoded INVISIBLE, ALTER INDEX strings with constants
SQL_INVISIBLE and SQL_ALTER_INDEX from MysqlSqlConstants.
…ABLE

buildAlterIndexVisibility was dead code: a visibility-only change fell
through to DROP+ADD, rebuilding the whole index. ALTER TABLE now emits
ALTER INDEX ... VISIBLE/INVISIBLE when the modified index differs from
the stored one only in visibility (and is not the primary key), and
falls back to the rebuild path otherwise.
@Aias00
Aias00 force-pushed the feature/mysql-invisible-index-2574 branch from c4e6228 to 925f102 Compare August 21, 2026 09:38
@Aias00
Aias00 requested a review from a team as a code owner August 21, 2026 09:38
@openai0229
openai0229 merged commit 48ba2c4 into OtterMind:main Sep 2, 2026
16 checks passed
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[MYSQL-OBJ-006] Manage visible and invisible MySQL indexes

3 participants