add sqlite db; add todos :-(; show current cameras

This commit is contained in:
2025-08-02 17:46:56 +02:00
parent 3f61f675e9
commit fe89c86004
14 changed files with 1653 additions and 31 deletions

26
migration.sql Normal file
View File

@@ -0,0 +1,26 @@
-- Enable foreign key constraints
PRAGMA foreign_keys = ON;
CREATE TABLE user (
uuid TEXT PRIMARY KEY,
name TEXT NOT NULL
);
CREATE TABLE camera (
uuid TEXT PRIMARY KEY,
desc TEXT,
name TEXT NOT NULL
);
CREATE TABLE sightings (
user_uuid TEXT NOT NULL,
sighted_at DATETIME NOT NULL,
camera_id TEXT NOT NULL,
FOREIGN KEY (user_uuid) REFERENCES user(uuid) ON DELETE CASCADE ON UPDATE CASCADE,
FOREIGN KEY (camera_id) REFERENCES camera(uuid) ON DELETE CASCADE ON UPDATE CASCADE,
UNIQUE (user_uuid, camera_id)
);
-- Create indexes for better performance on foreign key lookups
CREATE INDEX idx_sightings_user_uuid ON sightings(user_uuid);
CREATE INDEX idx_sightings_camera_id ON sightings(camera_id);