The code powering m.abunchtell.com https://m.abunchtell.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

19 行
748 B

  1. # frozen_string_literal: true
  2. class RemoveInvalidWebPushSubscription < ActiveRecord::Migration[5.2]
  3. disable_ddl_transaction!
  4. def up
  5. invalid_web_push_subscriptions = Web::PushSubscription.where(endpoint: '')
  6. .or(Web::PushSubscription.where(key_p256dh: ''))
  7. .or(Web::PushSubscription.where(key_auth: ''))
  8. .preload(:session_activation)
  9. invalid_web_push_subscriptions.find_each do |web_push_subscription|
  10. web_push_subscription.session_activation&.update!(web_push_subscription_id: nil)
  11. web_push_subscription.destroy!
  12. end
  13. end
  14. def down; end
  15. end