Skip to content

Commit

Permalink
Change existing migration to create Category
Browse files Browse the repository at this point in the history
Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/TCO-125

How does this address that need:

* Creates a Category "Flagged" if one does not already exist before
  trying to update data based on this specific Category

Document any side effects to this change:

* This migration has already run and it is normally not a good practice
  to update migrations to prevent databases from not bein in synch
  with the migration. In this case, all this does is introduce the code
  that was run manually in environments where this was run so it is
  fine and expected that those environments will not run it again.
  • Loading branch information
JPrevost committed Dec 11, 2024
1 parent 8e4fefe commit 6d68d87
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
class ChangeColumnNullConfirmationCategory < ActiveRecord::Migration[7.1]
def change
Category.find_or_create_by(
name: 'Flagged',
description: 'A search which has sensitive information that should be excluded from further processing.'
)

change_column_null :confirmations, :category_id, false, Category.find_by(name: 'Flagged').id
end
end

0 comments on commit 6d68d87

Please sign in to comment.