about summary refs log tree commit diff
path: root/db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb
blob: 69878ab944dffa08f545c3013359074249b6530b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class BackfillSemiprivateOnStatuses < ActiveRecord::Migration[5.2]
  disable_ddl_transaction!

  def up
    Rails.logger.info('Backfilling semiprivate statuses...')
    safety_assured do
      Status.where(id: StatusDomainPermission.select(:status_id).distinct(:status_id)).in_batches.update_all(semiprivate: true)
    end
  end

  def down
    true
  end
end