Files
oott/backend/database_migrations/03-add_device_events/up.sql
T
rzuastiandClaude Opus 4.7 0beca44496 Sort and look up text columns case-insensitively
Add COLLATE NOCASE on every text content column (names, owners, vendors,
device types, MAC addresses, notification titles/bodies/types, event
types) so DESC-by-name lists no longer order "iPad" before "Lutron".
Normalize MAC addresses to lowercase at the DB layer so the now
case-insensitive primary key cannot accept duplicate-looking rows.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 07:33:37 -04:00

9 lines
252 B
SQL

CREATE TABLE device_events(
id INTEGER PRIMARY KEY,
mac_address TEXT NOT NULL COLLATE NOCASE,
created_on TEXT NOT NULL,
event_type TEXT NOT NULL COLLATE NOCASE,
ipv4_address TEXT NOT NULL,
vendor TEXT NOT NULL COLLATE NOCASE
);