feat: camera_records table migration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
18
server/migrations/004_camera_records.sql
Normal file
18
server/migrations/004_camera_records.sql
Normal 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);
|
||||
Reference in New Issue
Block a user