File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -981,6 +981,44 @@ impl<'a> Connection<'a> {
981
981
}
982
982
}
983
983
984
+ pub fn pause_subgraph ( & self , site : & Site ) -> Result < ( ) , StoreError > {
985
+ use subgraph_deployment_assignment as a;
986
+
987
+ let conn = self . conn . as_ref ( ) ;
988
+
989
+ let updates = update ( a:: table. filter ( a:: id. eq ( site. id ) ) )
990
+ . set ( a:: paused_at. eq ( sql ( "now()" ) ) )
991
+ . execute ( conn) ?;
992
+ match updates {
993
+ 0 => Err ( StoreError :: DeploymentNotFound ( site. deployment . to_string ( ) ) ) ,
994
+ 1 => Ok ( ( ) ) ,
995
+ _ => {
996
+ // `id` is the primary key of the subgraph_deployment_assignment table,
997
+ // and we can therefore only update no or one entry
998
+ unreachable ! ( )
999
+ }
1000
+ }
1001
+ }
1002
+
1003
+ pub fn resume_subgraph ( & self , site : & Site ) -> Result < ( ) , StoreError > {
1004
+ use subgraph_deployment_assignment as a;
1005
+
1006
+ let conn = self . conn . as_ref ( ) ;
1007
+
1008
+ let updates = update ( a:: table. filter ( a:: id. eq ( site. id ) ) )
1009
+ . set ( a:: paused_at. eq ( sql ( "null" ) ) )
1010
+ . execute ( conn) ?;
1011
+ match updates {
1012
+ 0 => Err ( StoreError :: DeploymentNotFound ( site. deployment . to_string ( ) ) ) ,
1013
+ 1 => Ok ( ( ) ) ,
1014
+ _ => {
1015
+ // `id` is the primary key of the subgraph_deployment_assignment table,
1016
+ // and we can therefore only update no or one entry
1017
+ unreachable ! ( )
1018
+ }
1019
+ }
1020
+ }
1021
+
984
1022
pub fn reassign_subgraph (
985
1023
& self ,
986
1024
site : & Site ,
You can’t perform that action at this time.
0 commit comments