@@ -1839,6 +1839,20 @@ pub struct Mirror {
18391839}
18401840
18411841impl Mirror {
1842+ // The tables that we mirror
1843+ //
1844+ // `chains` needs to be mirrored before `deployment_schemas` because
1845+ // of the fk constraint on `deployment_schemas.network`. We don't
1846+ // care much about mirroring `active_copies` but it has a fk
1847+ // constraint on `deployment_schemas` and is tiny, therefore it's
1848+ // easiest to just mirror it
1849+ pub ( crate ) const PUBLIC_TABLES : [ & str ; 3 ] = [ "chains" , "deployment_schemas" , "active_copies" ] ;
1850+ pub ( crate ) const SUBGRAPHS_TABLES : [ & str ; 3 ] = [
1851+ "subgraph_deployment_assignment" ,
1852+ "subgraph" ,
1853+ "subgraph_version" ,
1854+ ] ;
1855+
18421856 pub fn new ( pools : & HashMap < Shard , ConnectionPool > ) -> Mirror {
18431857 let primary = pools
18441858 . get ( & PRIMARY_SHARD )
@@ -1895,18 +1909,6 @@ impl Mirror {
18951909 conn : & mut PgConnection ,
18961910 handle : & CancelHandle ,
18971911 ) -> Result < ( ) , StoreError > {
1898- // `chains` needs to be mirrored before `deployment_schemas` because
1899- // of the fk constraint on `deployment_schemas.network`. We don't
1900- // care much about mirroring `active_copies` but it has a fk
1901- // constraint on `deployment_schemas` and is tiny, therefore it's
1902- // easiest to just mirror it
1903- const PUBLIC_TABLES : [ & str ; 3 ] = [ "chains" , "deployment_schemas" , "active_copies" ] ;
1904- const SUBGRAPHS_TABLES : [ & str ; 3 ] = [
1905- "subgraph_deployment_assignment" ,
1906- "subgraph" ,
1907- "subgraph_version" ,
1908- ] ;
1909-
19101912 fn run_query ( conn : & mut PgConnection , query : String ) -> Result < ( ) , StoreError > {
19111913 conn. batch_execute ( & query) . map_err ( StoreError :: from)
19121914 }
@@ -1938,11 +1940,11 @@ impl Mirror {
19381940
19391941 // Truncate all tables at once, otherwise truncation can fail
19401942 // because of foreign key constraints
1941- let tables = PUBLIC_TABLES
1943+ let tables = Self :: PUBLIC_TABLES
19421944 . iter ( )
19431945 . map ( |name| ( NAMESPACE_PUBLIC , name) )
19441946 . chain (
1945- SUBGRAPHS_TABLES
1947+ Self :: SUBGRAPHS_TABLES
19461948 . iter ( )
19471949 . map ( |name| ( NAMESPACE_SUBGRAPHS , name) ) ,
19481950 )
@@ -1953,7 +1955,7 @@ impl Mirror {
19531955 check_cancel ( ) ?;
19541956
19551957 // Repopulate `PUBLIC_TABLES` by copying their data wholesale
1956- for table_name in PUBLIC_TABLES {
1958+ for table_name in Self :: PUBLIC_TABLES {
19571959 copy_table (
19581960 conn,
19591961 ForeignServer :: PRIMARY_PUBLIC ,
0 commit comments