From e85a2aa18dfb619e64f6f5acc6c401f72587fc72 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 8 Mar 2024 10:10:07 +0100 Subject: [PATCH] Fix interaction settings migration error when encountering no settings (#29529) --- .../20240304090449_migrate_interaction_settings_to_policy.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb b/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb index a167baadc..0e9a42f8d 100644 --- a/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb +++ b/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb @@ -20,6 +20,9 @@ class MigrateInteractionSettingsToPolicy < ActiveRecord::Migration[7.1] def up User.includes(account: :notification_policy).find_each do |user| deserialized_settings = Oj.load(user.attributes_before_type_cast['settings']) + + next if deserialized_settings.nil? + policy = user.account.notification_policy || user.account.build_notification_policy requires_new_policy = false