Your music, beautifully tracked. All yours. (coming soon) teal.fm
teal-fm atproto
at fix-compose-path 21 lines 792 B view raw
1use sqlx::{Pool, Postgres}; 2 3pub async fn refresh_materialized_views(pool: &Pool<Postgres>) -> Result<(), sqlx::Error> { 4 println!("Refreshing materialized views..."); 5 let mut tx = pool.begin().await?; 6 sqlx::query("REFRESH MATERIALIZED VIEW CONCURRENTLY mv_artist_play_counts") 7 .execute(&mut *tx) 8 .await?; 9 sqlx::query("REFRESH MATERIALIZED VIEW CONCURRENTLY mv_release_play_counts") 10 .execute(&mut *tx) 11 .await?; 12 sqlx::query("REFRESH MATERIALIZED VIEW CONCURRENTLY mv_recording_play_counts") 13 .execute(&mut *tx) 14 .await?; 15 sqlx::query("REFRESH MATERIALIZED VIEW CONCURRENTLY mv_global_play_count") 16 .execute(&mut *tx) 17 .await?; 18 tx.commit().await?; 19 println!("Materialized views refreshed."); 20 Ok(()) 21}