Skip to content

Commit

Permalink
no more auto foreign key
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Oct 31, 2023
1 parent 8b53960 commit 175855d
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ class Entry < ApplicationRecord

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
remove_foreign_key :bulkrax_entries, column: :importer_id if foreign_key_exists?(:bulkrax_entries, column: :importer_id)
remove_index :bulkrax_entries, :importer_id if index_exists?(:bulkrax_entries, :importer_id)
rename_column :bulkrax_entries, :importer_id, :importerexporter_id if column_exists?(:bulkrax_entries, :importer_id)
add_column :bulkrax_entries, :importerexporter_type, :string, after: :id, default: 'Bulkrax::Importer' unless column_exists?(:bulkrax_entries, :importerexporter_type)
end
end

0 comments on commit 175855d

Please sign in to comment.