mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Merge commit 'd0502ac3c1630e281fda5492cbc28390262b0aeb' into glitch-soc/merge-upstream
This commit is contained in:
@@ -4,14 +4,14 @@ class RejectFollowingBlockedUsers < ActiveRecord::Migration[5.2]
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
blocked_follows = Follow.find_by_sql(<<-SQL.squish)
|
||||
blocked_follows = Follow.find_by_sql(<<~SQL.squish)
|
||||
select f.* from follows f
|
||||
inner join blocks b on
|
||||
f.account_id = b.target_account_id and
|
||||
f.target_account_id = b.account_id
|
||||
SQL
|
||||
|
||||
domain_blocked_follows = Follow.find_by_sql(<<-SQL.squish)
|
||||
domain_blocked_follows = Follow.find_by_sql(<<~SQL.squish)
|
||||
select f.* from follows f
|
||||
inner join accounts following on f.account_id = following.id
|
||||
inner join account_domain_blocks b on
|
||||
|
||||
@@ -27,7 +27,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2]
|
||||
say 'Upsert is available, importing counters using the fast method'
|
||||
|
||||
Status.unscoped.select('id').find_in_batches(batch_size: 5_000) do |statuses|
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
INSERT INTO status_stats (status_id, reblogs_count, favourites_count, created_at, updated_at)
|
||||
SELECT id, reblogs_count, favourites_count, created_at, updated_at
|
||||
FROM statuses
|
||||
|
||||
@@ -31,7 +31,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2]
|
||||
say 'Upsert is available, importing counters using the fast method'
|
||||
|
||||
MigrationAccount.unscoped.select('id').find_in_batches(batch_size: 5_000) do |accounts|
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
INSERT INTO account_stats (account_id, statuses_count, following_count, followers_count, created_at, updated_at)
|
||||
SELECT id, statuses_count, following_count, followers_count, created_at, updated_at
|
||||
FROM accounts
|
||||
|
||||
@@ -5,7 +5,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1]
|
||||
# Preserve IDs as much as possible to not confuse existing clients.
|
||||
# As long as this migration is irreversible, we do not have to deal with conflicts.
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
INSERT INTO custom_filter_keywords (id, custom_filter_id, keyword, whole_word, created_at, updated_at)
|
||||
SELECT id, id, phrase, whole_word, created_at, updated_at
|
||||
FROM custom_filters
|
||||
@@ -16,7 +16,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1]
|
||||
def down
|
||||
# Copy back changes from custom filters guaranteed to be from the old API
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
UPDATE custom_filters
|
||||
SET phrase = custom_filter_keywords.keyword, whole_word = custom_filter_keywords.whole_word
|
||||
FROM custom_filter_keywords
|
||||
@@ -26,7 +26,7 @@ class MigrateCustomFilters < ActiveRecord::Migration[6.1]
|
||||
|
||||
# Drop every keyword as we can't safely provide a 1:1 mapping
|
||||
safety_assured do
|
||||
execute <<-SQL.squish
|
||||
execute <<~SQL.squish
|
||||
TRUNCATE custom_filter_keywords RESTART IDENTITY
|
||||
SQL
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user