The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
661 B

  1. # frozen_string_literal: true
  2. class RemoveBoostsWideningAudience < ActiveRecord::Migration[5.2]
  3. disable_ddl_transaction!
  4. def up
  5. public_boosts = Status.find_by_sql(<<-SQL)
  6. SELECT boost.id
  7. FROM statuses AS boost
  8. LEFT JOIN statuses AS boosted ON boost.reblog_of_id = boosted.id
  9. WHERE
  10. boost.id > 101746055577600000
  11. AND (boost.local = TRUE OR boost.uri IS NULL)
  12. AND boost.visibility IN (0, 1)
  13. AND boost.reblog_of_id IS NOT NULL
  14. AND boosted.visibility = 2
  15. SQL
  16. RemovalWorker.push_bulk(public_boosts.pluck(:id))
  17. end
  18. def down
  19. raise ActiveRecord::IrreversibleMigration
  20. end
  21. end