Skip to content

Commit 44b471c

Browse files
Add guard to uploaded_files migration (#994)
* 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 <rob@notch8.com> --------- Co-authored-by: Rob Kaufman <rob@notch8.com>
1 parent 46bb6d2 commit 44b471c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class AddFileNameToUploadedFiles < ActiveRecord::Migration[5.2]
22
def change
3-
add_column :uploaded_files, :filename, :string unless column_exists?(:uploaded_files, :filename)
3+
add_column :uploaded_files, :filename, :string if table_exists?(:uploaded_files) && !column_exists?(:uploaded_files, :filename)
44
end
55
end

0 commit comments

Comments
 (0)