--- useragents


CREATE TABLE user_agents (
  id         BIGINT PRIMARY KEY,
  org_id     BIGINT      NOT NULL REFERENCES orgs (id),
  user_agent VARCHAR     NOT NULL,
  created_at TIMESTAMPTZ NOT NULL
);


CREATE SEQUENCE user_agents_id_seq;

CREATE UNIQUE INDEX user_agents_org_id_user_agent_uniq
  ON user_agents (org_id, lower(user_agent));
