Skip to content

Commit

Permalink
⚙️ Add guard for new migrations
Browse files Browse the repository at this point in the history
This commit will add a guard to the new migrations to ensure that they
do not run if the columns already exist in the database.
  • Loading branch information
kirkkwang committed Sep 18, 2024
1 parent d4d4749 commit 7011d72
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddLastImportedAtToBulkraxImporters < ActiveRecord::Migration[5.1]
def change
add_column :bulkrax_importers, :last_imported_at, :datetime
add_column :bulkrax_importers, :last_imported_at, :datetime unless column_exists?(:bulkrax_importers, :last_imported_at)
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddNextImportAtToBulkraxImporters < ActiveRecord::Migration[5.1]
def change
add_column :bulkrax_importers, :next_import_at, :datetime
add_column :bulkrax_importers, :next_import_at, :datetime unless column_exists?(:bulkrax_importers, :next_import_at)
end
end

0 comments on commit 7011d72

Please sign in to comment.