async fn append_event( tx: &mut Transaction<'_, Sqlite>, id: &str, now: i64, event_type: &str, payload: &Value, ) -> Result<i64>