@@ -6,7 +6,7 @@ namespace :check do
66 last_team_id = Rails . cache . read ( 'check:migrate:delete_slack_notification_cached_data' ) || 0
77 Team . where ( 'id > ?' , last_team_id ) . find_each do |team |
88 puts "Processing team #{ team . id } \n "
9- puts "\n Delete cache for smooch_user\n "
9+ puts "\n Delete cache for smooch_user[ #{ team . id } ] \n "
1010 Annotation . where ( annotated_type : 'Team' , annotated_id : team . id , annotation_type : 'smooch_user' )
1111 . find_in_batches ( batch_size : 1000 ) do |annotations |
1212 a_ids = annotations . pluck ( :id )
@@ -29,10 +29,9 @@ namespace :check do
2929 end
3030 end
3131 # Delete `slack_message` annotations
32- puts "\n Delete PG data for slack message annotations\n "
33- smooch = BotUser . smooch_user
32+ puts "\n Delete PG data for slack message annotations[#{ team . id } ]\n "
3433 fields = [ "slack_message_id" , "slack_message_channel" , "slack_message_attachments" , "slack_message_token" ]
35- team . project_medias . where ( user_id : smooch . id ) . find_in_batches ( batch_size : 1000 ) do |items |
34+ team . project_medias . find_in_batches ( batch_size : 1000 ) do |items |
3635 pm_ids = items . pluck ( :id )
3736 Annotation . where ( annotated_type : 'ProjectMedia' , annotated_id : pm_ids , annotation_type : 'slack_message' )
3837 . find_in_batches ( batch_size : 1000 ) do |annotations |
0 commit comments