Skip to content

Commit

Permalink
Add migration (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanmsmith authored Jul 14, 2023
1 parent 640f611 commit 40921d6
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# typed: strict
# frozen_string_literal: true

extend Rake::DSL # rubocop:disable Style/MixinUsage

namespace :data_migration do
desc "Backfill the first_approved_at date for already approved reviews"
task backfill_subscribers_to_announcements_mailing_list: :environment do
Rails.logger = Logger.new($stdout)
ActiveRecord::Base.logger = Rails.logger

# Change to :debug for ActiveRecord SQL logs.
Rails.logger.level = :info

ActiveRecord::Base.transaction do
User.all.find_each do |user|
user.subscribe("announcements") unless user.subscribed?("announcements")
user.save
end
end
end
end

0 comments on commit 40921d6

Please sign in to comment.