@@ -492,6 +492,119 @@ impl Table for RustcCompilation {
492492 }
493493}
494494
495+ struct RuntimePstat ;
496+
497+ #[ derive( Serialize ) ]
498+ struct RuntimePstatRow {
499+ series : i32 ,
500+ aid : i32 ,
501+ cid : i32 ,
502+ value : f64 ,
503+ }
504+
505+ impl Table for RuntimePstat {
506+ fn name ( ) -> & ' static str {
507+ "runtime_pstat"
508+ }
509+
510+ fn sqlite_attributes ( ) -> & ' static str {
511+ "series, aid, cid, value"
512+ }
513+
514+ fn postgres_attributes ( ) -> & ' static str {
515+ "series, aid, cid, value"
516+ }
517+
518+ fn postgres_generated_id_attribute ( ) -> Option < & ' static str > {
519+ None
520+ }
521+
522+ fn write_postgres_csv_row < W : Write > ( writer : & mut csv:: Writer < W > , row : & rusqlite:: Row ) {
523+ writer
524+ . serialize ( PstatRow {
525+ series : row. get ( 0 ) . unwrap ( ) ,
526+ aid : row. get ( 1 ) . unwrap ( ) ,
527+ cid : row. get ( 2 ) . unwrap ( ) ,
528+ value : row. get ( 3 ) . unwrap ( ) ,
529+ } )
530+ . unwrap ( ) ;
531+ }
532+ }
533+
534+ struct RuntimePstatSeries ;
535+
536+ #[ derive( Serialize ) ]
537+ struct RuntimePstatSeriesRow < ' a > {
538+ id : i32 ,
539+ benchmark : & ' a str ,
540+ metric : & ' a str ,
541+ }
542+
543+ impl Table for RuntimePstatSeries {
544+ fn name ( ) -> & ' static str {
545+ "runtime_pstat_series"
546+ }
547+
548+ fn sqlite_attributes ( ) -> & ' static str {
549+ "id, benchmark, metric"
550+ }
551+
552+ fn postgres_attributes ( ) -> & ' static str {
553+ "id, benchmark, metric"
554+ }
555+
556+ fn postgres_generated_id_attribute ( ) -> Option < & ' static str > {
557+ Some ( "id" )
558+ }
559+
560+ fn write_postgres_csv_row < W : Write > ( writer : & mut csv:: Writer < W > , row : & rusqlite:: Row ) {
561+ writer
562+ . serialize ( RuntimePstatSeriesRow {
563+ id : row. get ( 0 ) . unwrap ( ) ,
564+ benchmark : row. get_ref ( 1 ) . unwrap ( ) . as_str ( ) . unwrap ( ) ,
565+ metric : row. get_ref ( 2 ) . unwrap ( ) . as_str ( ) . unwrap ( ) ,
566+ } )
567+ . unwrap ( ) ;
568+ }
569+ }
570+
571+ struct ArtifactSize ;
572+
573+ #[ derive( Serialize ) ]
574+ struct ArtifactSizeRow < ' a > {
575+ aid : i32 ,
576+ component : & ' a str ,
577+ size : i32 ,
578+ }
579+
580+ impl Table for ArtifactSize {
581+ fn name ( ) -> & ' static str {
582+ "artifact_size"
583+ }
584+
585+ fn sqlite_attributes ( ) -> & ' static str {
586+ "aid, component, size"
587+ }
588+
589+ fn postgres_attributes ( ) -> & ' static str {
590+ "aid, component, size"
591+ }
592+
593+ fn postgres_generated_id_attribute ( ) -> Option < & ' static str > {
594+ None
595+ }
596+
597+ fn write_postgres_csv_row < W : Write > ( writer : & mut csv:: Writer < W > , row : & rusqlite:: Row ) {
598+ writer
599+ . serialize ( ArtifactSizeRow {
600+ aid : row. get ( 0 ) . unwrap ( ) ,
601+ component : row. get_ref ( 1 ) . unwrap ( ) . as_str ( ) . unwrap ( ) ,
602+ size : row. get ( 2 ) . unwrap ( ) ,
603+ } )
604+ . unwrap ( ) ;
605+ }
606+ }
607+
495608// `Nullable<T>` helps to work around the fact that the `csv` crate (and the CSV
496609// format in general) doesn't distinguish between nulls and empty strings, while
497610// the Postgres CSV format does.
@@ -620,6 +733,9 @@ async fn main() -> anyhow::Result<()> {
620733 copy :: < PullRequestBuild > ( & sqlite_tx, & postgres_tx) . await ;
621734 copy :: < RawSelfProfile > ( & sqlite_tx, & postgres_tx) . await ;
622735 copy :: < RustcCompilation > ( & sqlite_tx, & postgres_tx) . await ;
736+ copy :: < RuntimePstatSeries > ( & sqlite_tx, & postgres_tx) . await ;
737+ copy :: < RuntimePstat > ( & sqlite_tx, & postgres_tx) . await ;
738+ copy :: < ArtifactSize > ( & sqlite_tx, & postgres_tx) . await ;
623739 enable_table_triggers ( & postgres_tx, & tables) . await ;
624740
625741 // This is overly paranoid, but don't commit the Postgres transaction until
0 commit comments