Sha256: 839797d64128b7a0764aa5720e400938709b25d5916b0d442cad3a9a505d5c82

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

# This migration comes from bulkrax (originally 20230608153601)
class AddIndicesToBulkrax < ActiveRecord::Migration[5.1]
  def change
    check_and_add_index :bulkrax_entries, :identifier
    check_and_add_index :bulkrax_entries, :type
    check_and_add_index :bulkrax_entries, [:importerexporter_id, :importerexporter_type], name: 'bulkrax_entries_importerexporter_idx'
    check_and_add_index :bulkrax_pending_relationships, :parent_id
    check_and_add_index :bulkrax_pending_relationships, :child_id
    check_and_add_index :bulkrax_statuses, [:statusable_id, :statusable_type], name: 'bulkrax_statuses_statusable_idx'
    check_and_add_index :bulkrax_statuses, [:runnable_id, :runnable_type], name: 'bulkrax_statuses_runnable_idx'
    check_and_add_index :bulkrax_statuses, :error_class
  end

  if RUBY_VERSION =~ /^2/
    def check_and_add_index(table_name, column_name, options = {})
      add_index(table_name, column_name, options) unless index_exists?(table_name, column_name, options)
    end
  elsif RUBY_VERSION =~ /^3/
    def check_and_add_index(table_name, column_name, **options)
      add_index(table_name, column_name, **options) unless index_exists?(table_name, column_name, **options)
    end
  else
    raise "Ruby version #{RUBY_VERSION} is unknown"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bulkrax-9.0.2 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-9.0.1 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-9.0.0 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-8.2.3 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-8.2.2 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-8.3.0 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-8.2.1 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-8.2.0 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-8.1.0 db/migrate/20230608153601_add_indices_to_bulkrax.rb
bulkrax-8.0.0 db/migrate/20230608153601_add_indices_to_bulkrax.rb