@@ -27,7 +27,7 @@ pub struct EventTableStruct {
2727    pub  event_type :  String , 
2828    pub  payload :  String , 
2929    pub  body :  Option < String > , 
30-     pub  abnormal :  bool , 
30+     pub  abnormal :  i32 , 
3131    pub  created_at :  DateTime < Utc > , 
3232} 
3333
@@ -97,15 +97,15 @@ impl EventTableStruct {
9797        for  chunk in  events. chunks ( chunk_size) . filter ( |c| !c. is_empty ( ) )  { 
9898            let  sql = "INSERT INTO data.events ( 
9999                id, actor_id, actor_login, repo_id, repo_name, org_id, org_login, 
100-                 event_type, payload, body, created_at 
100+                 event_type, payload, body, abnormal, created_at 
101101            ) 
102102            SELECT * FROM unnest( 
103103                $1::bigint[], $2::bigint[], $3::text[], $4::bigint[], $5::text[], 
104104                $6::bigint[], $7::text[], $8::text[], $9::json[], $10::text[], 
105-                 $11::timestamptz[] 
105+                 $11::integer[], $12:: timestamptz[] 
106106            ) AS t( 
107107                id, actor_id, actor_login, repo_id, repo_name, org_id, org_login, 
108-                 event_type, payload, body, created_at 
108+                 event_type, payload, body, abnormal,  created_at 
109109            ) 
110110            ON CONFLICT (id, created_at) DO NOTHING" ; 
111111
@@ -120,6 +120,7 @@ impl EventTableStruct {
120120                . bind ( Self :: vec ( chunk,  |data| data. event_type . clone ( ) ) ) 
121121                . bind ( Self :: vec ( chunk,  |data| data. payload . clone ( ) ) ) 
122122                . bind ( Self :: vec ( chunk,  |data| data. body . clone ( ) ) ) 
123+                 . bind ( Self :: vec ( chunk,  |data| data. abnormal ) ) 
123124                . bind ( Self :: vec ( chunk,  |data| data. created_at ) ) 
124125                . execute ( & db_pool ( ) ?) 
125126                . await ?; 
0 commit comments