You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
858 B

  1. -- Visits tracking table
  2. -- Postgres dialect
  3. create table visits (
  4. id serial primary key,
  5. user_id integer references users(id) on delete set null,
  6. proposal_id integer not null,
  7. path text not null,
  8. method text not null,
  9. query_string text,
  10. status_code integer,
  11. ip_address text,
  12. user_agent text,
  13. referrer text,
  14. session_id text,
  15. request_id text,
  16. visited_at timestamptz not null default now(),
  17. created_at timestamptz not null default now(),
  18. updated_at timestamptz not null default now()
  19. );
  20. -- Helpful indexes for analytics and lookups
  21. create index idx_visits_visited_at on visits(visited_at);
  22. create index idx_visits_user_id on visits(user_id);
  23. create index idx_visits_proposal_id on visits(proposal_id);
  24. create index idx_visits_path on visits(path);
  25. create index idx_visits_method on visits(method);