2023-07-12 09:47:08 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-12-13 23:21:14 +01:00
|
|
|
class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1]
|
|
|
|
def up
|
|
|
|
reapplication_follow_recommendations_v2 do
|
|
|
|
drop_view :account_summaries, materialized: true
|
2024-01-30 19:21:30 +01:00
|
|
|
create_view :account_summaries, version: 2, materialized: true
|
2021-12-13 23:21:14 +01:00
|
|
|
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
|
2024-01-30 19:21:30 +01:00
|
|
|
create_view :account_summaries, version: 1, materialized: true
|
2021-12-13 23:21:14 +01:00
|
|
|
safety_assured { add_index :account_summaries, :account_id, unique: true }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def reapplication_follow_recommendations_v2
|
|
|
|
drop_view :follow_recommendations, materialized: true
|
|
|
|
yield
|
2024-01-30 19:21:30 +01:00
|
|
|
create_view :follow_recommendations, version: 2, materialized: true
|
2021-12-13 23:21:14 +01:00
|
|
|
safety_assured { add_index :follow_recommendations, :account_id, unique: true }
|
|
|
|
end
|
|
|
|
end
|