Skip to content

Commit

Permalink
Add guard to uploaded_files migration (#994)
Browse files Browse the repository at this point in the history
* Add guard to uploaded_files migration

This commit will check if uploaded_files is a table before adding the
file_name column to it.  In a Hydra application, it is not so this was
crashing.

* Update db/migrate/20240806161142_add_file_name_to_uploaded_files.rb

Co-authored-by: Rob Kaufman <[email protected]>

---------

Co-authored-by: Rob Kaufman <[email protected]>
  • Loading branch information
kirkkwang and orangewolf authored Dec 18, 2024
1 parent 46bb6d2 commit 44b471c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddFileNameToUploadedFiles < ActiveRecord::Migration[5.2]
def change
add_column :uploaded_files, :filename, :string unless column_exists?(:uploaded_files, :filename)
add_column :uploaded_files, :filename, :string if table_exists?(:uploaded_files) && !column_exists?(:uploaded_files, :filename)
end
end

0 comments on commit 44b471c

Please sign in to comment.