Skip to content

Add rename_indexes_for_table partitioning helper

Matt Kasa requested to merge database-partitioning-index-renaming into master

What does this MR do and why?

Adds the indexes_by_definition_for_table and rename_indexes_for_table database partitioning migration helper methods.

These methods allow you to capture the index names for indexes on a table, then restore those names after an operation has regenerated the index names.

This is needed when making a table the first partition of itself, where the index names change as you go through this ALTER/CREATE workflow:

graph TD
    A[index_table_on_created_at] -->|ALTER TABLE table RENAME TO table_1| B
    B[index_table_on_created_at]
    B -->|"CREATE TABLE table (LIKE table_1 INCLUDING ALL)"| C
    C[table_created_at_idx]

Relates to #370274 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Matt Kasa

Merge request reports