Skip to content

Commit

Permalink
Fix error when migrating MySQL db (ref #393) (#573)
Browse files Browse the repository at this point in the history
fix error when migrating MySQL db (ref #393)
  • Loading branch information
bkiahstroud authored Jun 21, 2022
1 parent 3ca0eb2 commit 1702128
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
class RenameBulkraxImporterRunToImporterRun < ActiveRecord::Migration[5.2]
def change
def up
if column_exists?(:bulkrax_pending_relationships, :bulkrax_importer_run_id)
remove_foreign_key :bulkrax_pending_relationships, :bulkrax_importer_runs
remove_index :bulkrax_pending_relationships, column: :bulkrax_importer_run_id

rename_column :bulkrax_pending_relationships, :bulkrax_importer_run_id, :importer_run_id

add_foreign_key :bulkrax_pending_relationships, :bulkrax_importer_runs, column: :importer_run_id
add_index :bulkrax_pending_relationships, :importer_run_id, name: 'index_bulkrax_pending_relationships_on_importer_run_id'
end
end

def down
rename_column :bulkrax_pending_relationships, :importer_run_id, :bulkrax_importer_run_id
end
end

0 comments on commit 1702128

Please sign in to comment.