1
0

15 lines
782 B
SQL

select
CAST(extract(epoch from "createdAt") as integer) as "insertedAt"
, "instanceId"
, COALESCE((stats->>'numberOfUsers')::integer, -1) as users
, COALESCE((stats->>'numberOfLocalGroups')::integer, -1) as local_groups
, COALESCE((stats->>'numberOfGroups')::integer, -1) as total_groups
, COALESCE((stats->>'numberOfLocalEvents')::integer, -1) as local_events
, COALESCE((stats->>'numberOfEvents')::integer, -1) as total_events
, COALESCE((stats->>'numberOfLocalComments')::integer, -1) as localcomments
, COALESCE((stats->>'numberOfComments')::integer, -1) as total_comments
, COALESCE((stats->>'numberOfInstanceFollowings')::integer, -1) as followings
, COALESCE((stats->>'numberOfInstanceFollowers')::integer, -1) as followers
from history
order by "insertedAt", "instanceId"