--- useragents


CREATE TABLE user_agents (
  id         BIGINT IDENTITY (1,1) PRIMARY KEY,
  org_id     BIGINT      NOT NULL REFERENCES orgs (id),
  user_agent NVARCHAR(1024)     NOT NULL,
  user_agent_lower AS lower(user_agent),
  created_at DATETIMEOFFSET NOT NULL
);

CREATE UNIQUE INDEX user_agents_org_id_user_agent_uniq
  ON user_agents (org_id, user_agent_lower);
