You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
943 B

  1. class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1]
  2. def up
  3. reapplication_follow_recommendations_v2 do
  4. drop_view :account_summaries, materialized: true
  5. create_view :account_summaries, version: 2, materialized: { no_data: true }
  6. safety_assured { add_index :account_summaries, :account_id, unique: true }
  7. end
  8. end
  9. def down
  10. reapplication_follow_recommendations_v2 do
  11. drop_view :account_summaries, materialized: true
  12. create_view :account_summaries, version: 1, materialized: { no_data: true }
  13. safety_assured { add_index :account_summaries, :account_id, unique: true }
  14. end
  15. end
  16. def reapplication_follow_recommendations_v2
  17. drop_view :follow_recommendations, materialized: true
  18. yield
  19. create_view :follow_recommendations, version: 2, materialized: { no_data: true }
  20. safety_assured { add_index :follow_recommendations, :account_id, unique: true }
  21. end
  22. end