feat: camera_records table migration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 06:59:52 -07:00
parent 121f7a0a0a
commit a432813444

View File

@@ -0,0 +1,18 @@
-- migrations/004_camera_records.sql
-- Add camera_records table for TimerCamera-F door counter events
-- Apply: sqlite3 <db_file> < migrations/004_camera_records.sql
CREATE TABLE IF NOT EXISTS camera_records (
id INTEGER PRIMARY KEY AUTOINCREMENT,
device_id TEXT NOT NULL,
location_id TEXT NOT NULL,
period_start INTEGER NOT NULL,
period_end INTEGER NOT NULL,
entries INTEGER NOT NULL,
exits INTEGER NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
UNIQUE(device_id, period_start)
);
CREATE INDEX IF NOT EXISTS idx_camera_location_time
ON camera_records(location_id, period_start);