Class: AddChronoForgeWorkflowStateIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/chrono_forge/templates/add_chrono_forge_workflow_state_index.rb

Overview

Adds a composite [state, completed_at] index to chrono_forge_workflows. This supports state-based monitoring (stalled/failed dashboards) and the retention scan ChronoForge::Cleanup runs over completed workflows (the high-volume terminal state), which filters by completed_at. The state prefix also serves the smaller failed-workflow scan.

Shipped as a standalone migration (rather than folded into the install migration) so applications created with an earlier version of ChronoForge can pick it up via ‘rails generate chrono_forge:upgrade`.

Instance Method Summary collapse

Instance Method Details

#changeObject



18
19
20
21
22
# File 'lib/generators/chrono_forge/templates/add_chrono_forge_workflow_state_index.rb', line 18

def change
  add_index :chrono_forge_workflows, %i[state completed_at],
    if_not_exists: true,
    **chrono_forge_index_algorithm
end