Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add guard to uploaded_files migration
Browse files Browse the repository at this point in the history
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.
Kirk Wang committed Dec 10, 2024
1 parent 13a37b4 commit ca22cd2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion db/migrate/20240806161142_add_file_name_to_uploaded_files.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class AddFileNameToUploadedFiles < ActiveRecord::Migration[5.2]
def change
add_column :uploaded_files, :filename, :string unless column_exists?(:uploaded_files, :filename)
if table_exists?(:uploaded_files)
add_column :uploaded_files, :filename, :string unless column_exists?(:uploaded_files, :filename)
end
end
end

0 comments on commit ca22cd2

Please sign in to comment.