]> Untitled Git - lemmy.git/commitdiff
Alpha-ordering community follows. Fixes #2062 (#2079)
authorDessalines <dessalines@users.noreply.github.com>
Tue, 1 Feb 2022 20:00:54 +0000 (15:00 -0500)
committerGitHub <noreply@github.com>
Tue, 1 Feb 2022 20:00:54 +0000 (20:00 +0000)
crates/db_views_actor/src/community_follower_view.rs
migrations/2022-02-01-154240_add_community_title_index/down.sql [new file with mode: 0644]
migrations/2022-02-01-154240_add_community_title_index/up.sql [new file with mode: 0644]

index 7fbbcf8511e2fa3a1f830275f5e1e9cda82b260a..581d9b57cc630830ca8f5d54e6278973be07d593 100644 (file)
@@ -28,6 +28,7 @@ impl CommunityFollowerView {
         Person::safe_columns_tuple(),
       ))
       .filter(community_follower::community_id.eq(community_id))
+      .order_by(community::title)
       .load::<CommunityFollowerViewTuple>(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::<CommunityFollowerViewTuple>(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 (file)
index 0000000..8b927b7
--- /dev/null
@@ -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 (file)
index 0000000..50c267b
--- /dev/null
@@ -0,0 +1 @@
+create index idx_community_title on community(title);