Sha256: 7b7eb5c18e8547f59cc7232f3314d227b1bd6f376f8c9f2e9dbe92906816e5aa

Contents?: true

Size: 738 Bytes

Versions: 140

Compression:

Stored size: 738 Bytes

Contents

class ChangeTaskIdToUuid < ActiveRecord::Migration[4.2]
  def up
    if on_postgresql?
      change_table :job_invocations do |t|
        t.change :task_id, :uuid, :using => 'task_id::uuid'
      end

      change_table :template_invocations do |t|
        t.change :run_host_job_task_id, :uuid, :using => 'run_host_job_task_id::uuid'
      end
    end
  end

  def down
    if on_postgresql?
      change_table :job_invocations do |t|
        t.change :task_id, :string, :limit => 255
      end

      change_table :template_invocations do |t|
        t.change :run_host_job_task_id, :string, :limit => 255
      end
    end
  end

  private

  def on_postgresql?
    ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
  end
end

Version data entries

140 entries across 140 versions & 1 rubygems

Version Path
foreman_remote_execution-15.0.0 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.1.4 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.1.3 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.1.2 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.1.1 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.1.0 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.0.2 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.0.1 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.2.6 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-14.0.0 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.2.5 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.2.4 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.2.3 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.2.2 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-12.0.7 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.2.1 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.2.0 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-10.1.3 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-13.0.0 db/migrate/20180226095631_change_task_id_to_uuid.rb
foreman_remote_execution-12.0.5 db/migrate/20180226095631_change_task_id_to_uuid.rb