diff --git a/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb b/db/migrate/20240304090449_migrate_interaction_settings_to_policy.rb index a167baadcc..0e9a42f8df 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