Sha256: 3a7b7b97611734c2d99ce8a74fd8df7ba73c9efb0ee387f1a867a83f7f906588

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

Stored size: 702 Bytes

Contents

class ExtendTemplateInvocationEvents < ActiveRecord::Migration[6.1]
  def up
    change_table :template_invocation_events do |t|
      t.string :external_id
    end

    TemplateInvocationEvent.update_all("external_id = CASE WHEN event_type = 'exit' THEN 'exit' ELSE sequence_id::varchar END")

    remove_index :template_invocation_events, name: :unique_template_invocation_events_index
    remove_column :template_invocation_events, :sequence_id

    change_table :template_invocation_events do |t|
      t.index [:template_invocation_id, :external_id],
        unique: true,
        name: 'unique_template_invocation_events_index'
      t.change :external_id, :string, null: false
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_remote_execution-14.1.1 db/migrate/20240312133027_extend_template_invocation_events.rb
foreman_remote_execution-14.1.0 db/migrate/20240312133027_extend_template_invocation_events.rb