Rodrigo_Moraes

sql schema

Oct 22nd, 2021
2,167
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. organizationSummaries
  2. SELECT d.KEY, d.DATE, d.group_id, d.organization_id, d.DATA
  3. FROM public.data_summaries AS d
  4. WHERE (date_trunc('day', d.DATE) >= date_trunc('day', date_trunc('day', now()))) AND (d.organization_id = @__organizationId_0)
  5.  
  6. agents
  7. SELECT a.id, a.category_id, a.created_at, a.datetime_end, a.datetime_start, a.duration, a.efficiency_id, a.machine_user_id, a.organization_id, a.group_id, a.tracked_id, a.updated_at
  8. FROM organization_17.agent_collectors AS a
  9. WHERE date_trunc('day', a.datetime_start) >= date_trunc('day', date_trunc('day', now()))
  10.  
  11. get_machine users
  12. SELECT m.id, m.active, m.agent_version, m.alias, m.collect_logs, m.created_at, m.DOMAIN, m.email, m.generated_by_ad, m.IGNORE, m.last_activity, m.organization_id, m.pending_revision_ad, m.group_id, m.token, m.updated_at, m.username
  13. FROM organization_17.machine_users AS m
  14. WHERE m.active
  15.  
  16. agentCollectors =
  17. -- @__user_Id_0='10685' (Nullable = true)
  18. SELECT a.id, a.category_id, a.created_at, a.datetime_end, a.datetime_start, a.duration, a.efficiency_id, a.machine_user_id, a.organization_id, a.group_id, a.tracked_id, a.updated_at
  19. FROM organization_17.agent_collectors AS a
  20. WHERE (a.datetime_start >= date_trunc('day', now())) AND (a.machine_user_id = @__user_Id_0)
  21.  
  22. team  GROUP
  23. -- @__user_Id_0='10685' (Nullable = true)
  24. SELECT a.id, a.category_id, a.created_at, a.datetime_end, a.datetime_start, a.duration, a.efficiency_id, a.machine_user_id, a.organization_id, a.group_id, a.tracked_id, a.updated_at
  25. FROM organization_17.agent_collectors AS a
  26. WHERE (a.datetime_start >= date_trunc('day', now())) AND (a.machine_user_id = @__user_Id_0)
  27.  
  28. USER mood
  29. -- @__user_Id_0='10620'
  30. SELECT m.id, m.datetime_start, m.group_id, m.machine_user_id, m.mood
  31. FROM organization_17.moods AS m
  32. WHERE (m.machine_user_id = @__user_Id_0) AND (date_trunc('day', m.datetime_start) = date_trunc('day', date_trunc('day', now())))
  33.  
  34. GET USER ok
  35. SELECT m.id, m.datetime_start, m.group_id, m.machine_user_id, m.mood
  36. FROM organization_17.moods AS m
  37. WHERE (m.mood = 1) AND (m.datetime_start >= date_trunc('day', now()))
  38.  
  39. GET USER sad
  40. SELECT m.id, m.datetime_start, m.group_id, m.machine_user_id, m.mood
  41. FROM organization_17.moods AS m
  42. WHERE (m.mood = 0) AND (m.datetime_start >= date_trunc('day', now()))
  43.  
  44. GET USER happy
  45. SELECT m.id, m.datetime_start, m.group_id, m.machine_user_id, m.mood
  46. FROM organization_17.moods AS m
  47. WHERE (m.mood = 2) AND (m.datetime_start >= date_trunc('day', now()))
  48.  
  49.  
  50.  
  51.  
RAW Paste Data