forked from mastodon/mastodon
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add post-deployment migration script to delete public-boosts-of-priva…
…te-toots (mastodon#10783)
- Loading branch information
1 parent
aac4ae8
commit 3b769bf
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
db/post_migrate/20190519130537_remove_boosts_widening_audience.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class RemoveBoostsWideningAudience < ActiveRecord::Migration[5.2] | ||
disable_ddl_transaction! | ||
|
||
def up | ||
public_boosts = Status.find_by_sql(<<-SQL) | ||
SELECT boost.id | ||
FROM statuses AS boost | ||
LEFT JOIN statuses AS boosted ON boost.reblog_of_id = boosted.id | ||
WHERE | ||
boost.id > 101746055577600000 | ||
AND (boost.local = TRUE OR boost.uri IS NULL) | ||
AND boost.visibility IN (0, 1) | ||
AND boost.reblog_of_id IS NOT NULL | ||
AND boosted.visibility = 2 | ||
SQL | ||
|
||
RemovalWorker.push_bulk(public_boosts.pluck(:id)) | ||
end | ||
|
||
def down | ||
raise ActiveRecord::IrreversibleMigration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters