Sha256: a5a515c56b6375b95ece4ec89a5cdfc1126b375e552cd10ac8468a0f23c35751

Contents?: true

Size: 605 Bytes

Versions: 50

Compression:

Stored size: 605 Bytes

Contents

module Bulkrax
  class Entry < ApplicationRecord
     belongs_to :importer
  end
end

class ChangeImporterAndExporterToPolymorphic < ActiveRecord::Migration[5.1]
  def change
    if column_exists?(:bulkrax_entries, :importer_id)
      remove_foreign_key :bulkrax_entries, column: :importer_id
      remove_index :bulkrax_entries, :importer_id
      rename_column :bulkrax_entries, :importer_id, :importerexporter_id
    end
    add_column :bulkrax_entries, :importerexporter_type, :string, after: :id, default: 'Bulkrax::Importer' unless column_exists?(:bulkrax_entries, :importerexporter_type)
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
bulkrax-2.2.4 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.2.3 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.2.2 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.2.1 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.2.0 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.1.1 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.1.0 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.0.2 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.0.1 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb
bulkrax-2.0.0 db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb