- where: fragment("(?)->'object'->>'id' = ?", activity.data, ^to_string(ap_id))
- and fragment("(?)->>'type' = 'Create'", activity.data))
+ where: fragment("coalesce((?)->'object'->>'id', (?)->>'object') = ?", activity.data, activity.data, ^to_string(ap_id)),
+ where: fragment("(?)->>'type' = 'Create'", activity.data))