File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ fn read_rust_doc(file_path: &Path) -> Result<Option<String>> {
288288/// Get release_time, yanked and downloads from crates.io
289289fn get_release_time_yanked_downloads (
290290 pkg : & MetadataPackage ,
291- ) -> Result < ( Option < time:: Timespec > , Option < bool > , Option < i32 > ) > {
291+ ) -> Result < ( time:: Timespec , bool , i32 ) > {
292292 let url = format ! ( "https://crates.io/api/v1/crates/{}/versions" , pkg. name) ;
293293 // FIXME: There is probably better way to do this
294294 // and so many unwraps...
@@ -332,7 +332,7 @@ fn get_release_time_yanked_downloads(
332332 }
333333 }
334334
335- Ok ( ( release_time, yanked, downloads) )
335+ Ok ( ( release_time. unwrap_or ( time :: get_time ( ) ) , yanked. unwrap_or ( false ) , downloads. unwrap_or ( 0 ) ) )
336336}
337337
338338
Original file line number Diff line number Diff line change @@ -193,6 +193,16 @@ pub fn migrate(version: Option<Version>) -> CratesfyiResult<()> {
193193 // downgrade query
194194 "DROP TABLE sandbox_overrides;"
195195 ) ,
196+ migration!(
197+ 4 ,
198+ "Make more fields not null" ,
199+ "ALTER TABLE releases ALTER COLUMN release_time SET NOT NULL,
200+ ALTER COLUMN yanked SET NOT NULL,
201+ ALTER COLUMN downloads SET NOT NULL" ,
202+ "ALTER TABLE releases ALTER COLUMN release_time DROP NOT NULL,
203+ ALTER COLUMN yanked DROP NOT NULL,
204+ ALTER COLUMN downloads DROP NOT NULL"
205+ )
196206 ] ;
197207
198208 for migration in migrations {
You can’t perform that action at this time.
0 commit comments