mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-10 09:23:58 +08:00
Fix notification migration
This commit is contained in:
parent
720eceb59f
commit
203e28dbfe
2 changed files with 10 additions and 1 deletions
|
@ -19,7 +19,7 @@ class MigrateNotificationToNoticed < ActiveRecord::Migration[7.0]
|
|||
5 => 'DeliveryNotification',
|
||||
7 => 'DeliveryNotification'
|
||||
}
|
||||
UserNotification.includes(:notification).find_each do |user_notification|
|
||||
UserNotification.where('created_at > ?', 3.months.ago).includes(:notification).find_each do |user_notification|
|
||||
notification = user_notification.notification
|
||||
|
||||
new_type = type_mapping[notification.type_of]
|
||||
|
|
9
db/migrate/20231122125004_fix_notification_migration.rb
Normal file
9
db/migrate/20231122125004_fix_notification_migration.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
class FixNotificationMigration < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
Notification.find_each do |notification|
|
||||
parsed_params = JSON.parse(notification.params)
|
||||
parsed_params.delete('_aj_symbol_keys')
|
||||
notification.update!(params: parsed_params)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue