Change materialized views to be refreshed concurrently to avoid locks (#29015)
This commit is contained in:
@@ -4,7 +4,7 @@ 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 }
|
||||
create_view :account_summaries, version: 2, materialized: true
|
||||
safety_assured { add_index :account_summaries, :account_id, unique: true }
|
||||
end
|
||||
end
|
||||
@@ -12,7 +12,7 @@ class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1]
|
||||
def down
|
||||
reapplication_follow_recommendations_v2 do
|
||||
drop_view :account_summaries, materialized: true
|
||||
create_view :account_summaries, version: 1, materialized: { no_data: true }
|
||||
create_view :account_summaries, version: 1, materialized: true
|
||||
safety_assured { add_index :account_summaries, :account_id, unique: true }
|
||||
end
|
||||
end
|
||||
@@ -20,7 +20,7 @@ class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1]
|
||||
def reapplication_follow_recommendations_v2
|
||||
drop_view :follow_recommendations, materialized: true
|
||||
yield
|
||||
create_view :follow_recommendations, version: 2, materialized: { no_data: true }
|
||||
create_view :follow_recommendations, version: 2, materialized: true
|
||||
safety_assured { add_index :follow_recommendations, :account_id, unique: true }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user