From 6b1894faf062532a107f91527ae7a6a214e1ee32 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 1 Feb 2022 15:00:54 -0500 Subject: [PATCH] Alpha-ordering community follows. Fixes #2062 (#2079) --- crates/db_views_actor/src/community_follower_view.rs | 2 ++ migrations/2022-02-01-154240_add_community_title_index/down.sql | 1 + migrations/2022-02-01-154240_add_community_title_index/up.sql | 1 + 3 files changed, 4 insertions(+) create mode 100644 migrations/2022-02-01-154240_add_community_title_index/down.sql create mode 100644 migrations/2022-02-01-154240_add_community_title_index/up.sql diff --git a/crates/db_views_actor/src/community_follower_view.rs b/crates/db_views_actor/src/community_follower_view.rs index 7fbbcf85..581d9b57 100644 --- a/crates/db_views_actor/src/community_follower_view.rs +++ b/crates/db_views_actor/src/community_follower_view.rs @@ -28,6 +28,7 @@ impl CommunityFollowerView { Person::safe_columns_tuple(), )) .filter(community_follower::community_id.eq(community_id)) + .order_by(community::title) .load::(conn)?; Ok(Self::from_tuple_to_vec(res)) @@ -42,6 +43,7 @@ impl CommunityFollowerView { Person::safe_columns_tuple(), )) .filter(community_follower::person_id.eq(person_id)) + .order_by(community::title) .load::(conn)?; Ok(Self::from_tuple_to_vec(res)) diff --git a/migrations/2022-02-01-154240_add_community_title_index/down.sql b/migrations/2022-02-01-154240_add_community_title_index/down.sql new file mode 100644 index 00000000..8b927b7b --- /dev/null +++ b/migrations/2022-02-01-154240_add_community_title_index/down.sql @@ -0,0 +1 @@ +drop index idx_community_title; diff --git a/migrations/2022-02-01-154240_add_community_title_index/up.sql b/migrations/2022-02-01-154240_add_community_title_index/up.sql new file mode 100644 index 00000000..50c267bb --- /dev/null +++ b/migrations/2022-02-01-154240_add_community_title_index/up.sql @@ -0,0 +1 @@ +create index idx_community_title on community(title); -- 2.44.1