File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
- use diesel:: sql_types:: { Integer , Text } ;
1
+ use diesel:: sql_types:: { BigInt , Text } ;
2
2
3
3
use crate :: models:: { Crate , Version } ;
4
4
use crate :: schema:: * ;
@@ -29,8 +29,8 @@ pub struct Dependency {
29
29
pub struct ReverseDependency {
30
30
#[ diesel( embed) ]
31
31
pub dependency : Dependency ,
32
- #[ diesel( sql_type = Integer ) ]
33
- pub crate_downloads : i32 ,
32
+ #[ diesel( sql_type = BigInt ) ]
33
+ pub crate_downloads : i64 ,
34
34
#[ diesel( sql_type = Text , column_name = crate_name) ]
35
35
pub name : String ,
36
36
}
Original file line number Diff line number Diff line change 4
4
-- Apply pagination to the crates
5
5
SELECT * , COUNT (* ) OVER () as total FROM (
6
6
SELECT
7
- crates .downloads AS crate_downloads,
7
+ crate_downloads .downloads AS crate_downloads,
8
8
crates .name AS crate_name,
9
9
versions .id AS version_id
10
10
FROM
22
22
) versions
23
23
INNER JOIN crates
24
24
ON crates .id = versions .crate_id
25
+ INNER JOIN crate_downloads
26
+ ON crate_downloads .crate_id = crates .id
25
27
WHERE versions .id IN (SELECT version_id FROM dependencies WHERE crate_id = $1 )
26
28
) c
27
29
ORDER BY
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ pub struct EncodableDependency {
120
120
pub features : Vec < String > ,
121
121
pub target : Option < String > ,
122
122
pub kind : DependencyKind ,
123
- pub downloads : i32 ,
123
+ pub downloads : i64 ,
124
124
}
125
125
126
126
impl EncodableDependency {
@@ -134,7 +134,7 @@ impl EncodableDependency {
134
134
}
135
135
136
136
// `downloads` need only be specified when generating a reverse dependency
137
- fn encode ( dependency : Dependency , crate_name : & str , downloads : Option < i32 > ) -> Self {
137
+ fn encode ( dependency : Dependency , crate_name : & str , downloads : Option < i64 > ) -> Self {
138
138
Self {
139
139
id : dependency. id ,
140
140
version_id : dependency. version_id ,
You can’t perform that action at this time.
0 commit comments