Skip to content

Commit

Permalink
Update UPGRADE.md
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 authored Jan 18, 2024
1 parent 00767ee commit ee27b56
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ end

# Migrate each record to the new tables
Notification.find_each do |notification|
attributes = notification.attributes.slice("id", "type")
attributes[:type] = attributes[:type].sub("Notification", "Notifier"))
attributes = notification.attributes.slice("id", "type").with_indifferent_access
attributes[:type] = attributes[:type].sub("Notification", "Notifier")
attributes[:params] = Noticed::Coder.load(notification.params)
attributes[:params] = {} if attributes[:params].try(:has_key?, "noticed_error") # Skip invalid records
attributes[:notifications_attributes] = [{
type: "#{attributes[:type]}::Notification",
recipient_type: notification.recipient_type,
recipient_id: notification.recipient_id,
read_at: notification.read_at,
Expand Down

0 comments on commit ee27b56

Please sign in to comment.