From 7011d726bd9f2f37dc19a5f8bddb4089c09c3827 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Wed, 18 Sep 2024 09:25:40 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Add=20guard=20for=20new=20?= =?UTF-8?q?migrations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../20240916182737_add_last_imported_at_to_bulkrax_importers.rb | 2 +- .../20240916182823_add_next_import_at_to_bulkrax_importers.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/migrate/20240916182737_add_last_imported_at_to_bulkrax_importers.rb b/db/migrate/20240916182737_add_last_imported_at_to_bulkrax_importers.rb index 3cd782d0..24374800 100644 --- a/db/migrate/20240916182737_add_last_imported_at_to_bulkrax_importers.rb +++ b/db/migrate/20240916182737_add_last_imported_at_to_bulkrax_importers.rb @@ -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 diff --git a/db/migrate/20240916182823_add_next_import_at_to_bulkrax_importers.rb b/db/migrate/20240916182823_add_next_import_at_to_bulkrax_importers.rb index 26a76ce0..8d62c2bc 100644 --- a/db/migrate/20240916182823_add_next_import_at_to_bulkrax_importers.rb +++ b/db/migrate/20240916182823_add_next_import_at_to_bulkrax_importers.rb @@ -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