27875d655386f07bb3c7bbb848aebee80792bc3e
jcasper
  Thu Jun 4 09:14:26 2026 -0700
Adding a .sql to create the hguidIpAccess table for tracking recent hguid/ip
relationships (for managing bot traffic).  refs #37494

diff --git src/hg/lib/hguidIpAccess.sql src/hg/lib/hguidIpAccess.sql
new file mode 100644
index 00000000000..af396407b85
--- /dev/null
+++ src/hg/lib/hguidIpAccess.sql
@@ -0,0 +1,12 @@
+# hguidIpAccess.sql creates a database table to store recent accesses from
+# hguid/ip combinations.  The indices facilitate quick insert/update and
+# lookup, as this table will see a lot of traffic.
+
+CREATE TABLE hguidIpAccess (
+    userId int unsigned not null,       # User ID, matching an entry in userDb
+    ip varchar(45) not null,            # IP address this userId was seen from
+    lastSeen datetime not null,         # Most recent access time for this userId/ip combo
+            #Indices
+    PRIMARY KEY (userId, ip),
+    INDEX lastSeenIdx(lastSeen)
+);