diff --git a/db/migrate/20211203195233_rename_children_counters_to_relationships.rb b/db/migrate/20211203195233_rename_children_counters_to_relationships.rb index 45c61813..063b8dbd 100644 --- a/db/migrate/20211203195233_rename_children_counters_to_relationships.rb +++ b/db/migrate/20211203195233_rename_children_counters_to_relationships.rb @@ -1,6 +1,6 @@ class RenameChildrenCountersToRelationships < ActiveRecord::Migration[5.2] def change - rename_column :bulkrax_importer_runs, :processed_children, :processed_relationships - rename_column :bulkrax_importer_runs, :failed_children, :failed_relationships + rename_column :bulkrax_importer_runs, :processed_children, :processed_relationships unless column_exists?(:bulkrax_importer_runs, :processed_relationships) + rename_column :bulkrax_importer_runs, :failed_children, :failed_relationships unless column_exists?(:bulkrax_importer_runs, :failed_relationships) end end diff --git a/db/migrate/20220301001839_create_bulkrax_pending_relationships.rb b/db/migrate/20220301001839_create_bulkrax_pending_relationships.rb index 351613a0..375120b8 100644 --- a/db/migrate/20220301001839_create_bulkrax_pending_relationships.rb +++ b/db/migrate/20220301001839_create_bulkrax_pending_relationships.rb @@ -1,11 +1,13 @@ class CreateBulkraxPendingRelationships < ActiveRecord::Migration[5.2] def change - create_table :bulkrax_pending_relationships do |t| - t.belongs_to :bulkrax_importer_run, foreign_key: true, null: false - t.string :parent_id, null: false - t.string :child_id, null: false + unless table_exists?(:bulkrax_pending_relationships) + create_table :bulkrax_pending_relationships do |t| + t.belongs_to :bulkrax_importer_run, foreign_key: true, null: false + t.string :parent_id, null: false + t.string :child_id, null: false - t.timestamps + t.timestamps + end end end end diff --git a/db/migrate/20220303212810_add_order_to_bulkrax_pending_relationships.rb b/db/migrate/20220303212810_add_order_to_bulkrax_pending_relationships.rb index 4b93fc02..505da461 100644 --- a/db/migrate/20220303212810_add_order_to_bulkrax_pending_relationships.rb +++ b/db/migrate/20220303212810_add_order_to_bulkrax_pending_relationships.rb @@ -1,5 +1,5 @@ class AddOrderToBulkraxPendingRelationships < ActiveRecord::Migration[5.2] def change - add_column :bulkrax_pending_relationships, :order, :integer, default: 0 + add_column :bulkrax_pending_relationships, :order, :integer, default: 0 unless column_exists?(:bulkrax_pending_relationships, :order) end end