diff options
author | Takeshi Umeda <noel.yoshiba@gmail.com> | 2021-12-14 07:21:14 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-13 23:21:14 +0100 |
commit | bda8e4f815708bd4deeb3c2310732e0b7a4e15e8 (patch) | |
tree | 1527b1e3e410f5d713be783b34bf8a9c4ecc4844 /db/migrate | |
parent | 0fc73bbcb937d62c47a37325794825c77ef8a8a7 (diff) |
Fix follow recommendation biased towards older accounts (#17126)
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20211213040746_update_account_summaries_to_version_2.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20211213040746_update_account_summaries_to_version_2.rb b/db/migrate/20211213040746_update_account_summaries_to_version_2.rb new file mode 100644 index 000000000..0d1f092ec --- /dev/null +++ b/db/migrate/20211213040746_update_account_summaries_to_version_2.rb @@ -0,0 +1,24 @@ +class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1] + def up + reapplication_follow_recommendations_v2 do + drop_view :account_summaries, materialized: true + create_view :account_summaries, version: 2, materialized: { no_data: true } + safety_assured { add_index :account_summaries, :account_id, unique: true } + end + end + + def down + reapplication_follow_recommendations_v2 do + drop_view :account_summaries, materialized: true + create_view :account_summaries, version: 1, materialized: { no_data: true } + safety_assured { add_index :account_summaries, :account_id, unique: true } + end + end + + def reapplication_follow_recommendations_v2 + drop_view :follow_recommendations, materialized: true + yield + create_view :follow_recommendations, version: 2, materialized: { no_data: true } + safety_assured { add_index :follow_recommendations, :account_id, unique: true } + end +end |