Skip to content

Duplicate index migration fails when an index is already absent #471

Description

@jakduch

Problem

020_drop_duplicate_indices unconditionally drops three indexes that duplicate primary-key constraints. If one of those indexes is already absent, dynflow:migrate aborts with PG::UndefinedObject instead of accepting that index as already removed.

This prevents Foreman from completing its database migration. The failure was reported in Foreman Redmine #31736 with Dynflow 1.4.7, and migration 020 remains functionally unchanged in Dynflow 2.0.1.

Expected behavior

Migration 020 should treat an already-absent duplicate index as the desired state and continue removing any remaining duplicate indexes.

Proposed fix

Check the indexes exposed by Sequel before dropping each one, and add a regression test for a schema where one duplicate index is already missing before migration 020 runs.

AI usage disclosure

This issue was investigated and prepared with the assistance of Codex 5.6 Sol High. The findings were reviewed before submitting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions