max / makenotwork
| 1 | -- Migration 130: index user_sessions(ip_address) |
| 2 | -- |
| 3 | -- Audit Run #3 (Perf LOW): `count_active_sandboxes_for_ip` (db/mod.rs) |
| 4 | -- filters `user_sessions.ip_address = $1` without an index, so the abuse |
| 5 | -- prevention cap that fires on every sandbox signup table-scans |
| 6 | -- user_sessions. Partial index over the non-null subset since ip_address |
| 7 | -- is nullable (legacy sessions predating session tracking can carry NULL). |
| 8 | |
| 9 | NOT EXISTS idx_user_sessions_ip_address |
| 10 | ON user_sessions(ip_address) |
| 11 | WHERE ip_address IS NOT NULL; |
| 12 |