Not sure how this was overlooked during #292, but we dont seem to have any kind of mechanism to ensure that any materialized views that get updated (likely recreated) also have their indexes recreated.
see also #314
|
# NOTE FOR DEVELOPERS: alembic_utils manages materialized view definitions via |
|
# DROP + CREATE (replace). When a view is replaced: |
|
# |
|
# 1. ALL indexes are destroyed. Manually add CREATE UNIQUE INDEX statements |
|
# after the replace op, using MaterializedView.unique_index_columns from |
|
# the registry (collectoss/application/db/materialized_views.py). |
|
# |
|
# 2. The view is recreated WITH NO DATA. You CANNOT run REFRESH CONCURRENTLY |
|
# immediately — it requires both a unique index and pre-existing data. |
|
# After recreating the index, run a non-concurrent refresh first: |
|
# REFRESH MATERIALIZED VIEW augur_data.<view_name> WITH DATA; |
|
# Only after that will the Celery refresh task's CONCURRENTLY succeed. |
|
# |
Not sure how this was overlooked during #292, but we dont seem to have any kind of mechanism to ensure that any materialized views that get updated (likely recreated) also have their indexes recreated.
see also #314
CollectOSS/collectoss/application/schema/alembic/env.py
Lines 29 to 41 in fd9a862