4
4
use crate :: { advisory_lock, detail:: GraphNodeVersion , primary:: DeploymentId } ;
5
5
use diesel:: {
6
6
connection:: SimpleConnection ,
7
- dsl:: { count, delete, insert_into, select, sql, update} ,
7
+ dsl:: { count, delete, insert_into, now , select, sql, update} ,
8
8
sql_types:: { Bool , Integer } ,
9
9
} ;
10
10
use diesel:: { expression:: SqlLiteral , pg:: PgConnection , sql_types:: Numeric } ;
@@ -132,7 +132,7 @@ table! {
132
132
deployment -> Text ,
133
133
failed -> Bool ,
134
134
health -> crate :: deployment:: SubgraphHealthMapping ,
135
- synced -> Bool ,
135
+ synced_at -> Nullable < Timestamptz > ,
136
136
fatal_error -> Nullable <Text >,
137
137
non_fatal_errors -> Array <Text >,
138
138
earliest_block_number -> Integer ,
@@ -737,9 +737,9 @@ pub fn set_synced(conn: &mut PgConnection, id: &DeploymentHash) -> Result<(), St
737
737
update (
738
738
d:: table
739
739
. filter ( d:: deployment. eq ( id. as_str ( ) ) )
740
- . filter ( d:: synced . eq ( false ) ) ,
740
+ . filter ( d:: synced_at . is_null ( ) ) ,
741
741
)
742
- . set ( d:: synced . eq ( true ) )
742
+ . set ( d:: synced_at . eq ( now ) )
743
743
. execute ( conn) ?;
744
744
Ok ( ( ) )
745
745
}
@@ -762,7 +762,7 @@ pub fn exists_and_synced(conn: &mut PgConnection, id: &str) -> Result<bool, Stor
762
762
763
763
let synced = d:: table
764
764
. filter ( d:: deployment. eq ( id) )
765
- . select ( d:: synced )
765
+ . select ( d:: synced_at . is_not_null ( ) )
766
766
. first ( conn)
767
767
. optional ( ) ?
768
768
. unwrap_or ( false ) ;
@@ -1142,7 +1142,6 @@ pub fn create_deployment(
1142
1142
d:: id. eq ( site. id ) ,
1143
1143
d:: deployment. eq ( site. deployment . as_str ( ) ) ,
1144
1144
d:: failed. eq ( false ) ,
1145
- d:: synced. eq ( false ) ,
1146
1145
d:: health. eq ( SubgraphHealth :: Healthy ) ,
1147
1146
d:: fatal_error. eq :: < Option < String > > ( None ) ,
1148
1147
d:: non_fatal_errors. eq :: < Vec < String > > ( vec ! [ ] ) ,
0 commit comments