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.

18 lines
615 B

  1. class UpdateFollowRecommendationsToVersion2 < ActiveRecord::Migration[6.1]
  2. # We're switching from a normal to a materialized view so we need
  3. # custom `up` and `down` paths.
  4. def up
  5. drop_view :follow_recommendations
  6. create_view :follow_recommendations, version: 2, materialized: true
  7. # To be able to refresh the view concurrently,
  8. # at least one unique index is required
  9. safety_assured { add_index :follow_recommendations, :account_id, unique: true }
  10. end
  11. def down
  12. drop_view :follow_recommendations, materialized: true
  13. create_view :follow_recommendations, version: 1
  14. end
  15. end