Initial commit - Phase 3/4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
michael
2026-01-06 13:45:29 -08:00
parent 1da6730735
commit 4f35df1781
323 changed files with 98287 additions and 1195 deletions

View File

@@ -10,16 +10,40 @@ async def init_db():
config.DATA_DIR.mkdir(parents=True, exist_ok=True)
async with aiosqlite.connect(config.DATABASE_PATH) as db:
# Sessions table
# Devices table (NEW for multi-device support)
await db.execute("""
CREATE TABLE IF NOT EXISTS devices (
device_id TEXT PRIMARY KEY,
device_path TEXT NOT NULL,
serial_number TEXT,
friendly_name TEXT,
usb_vid TEXT,
usb_pid TEXT,
first_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_seen TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
firmware_version TEXT,
bootrom_version TEXT,
metadata TEXT,
version_mismatch_ignored BOOLEAN DEFAULT FALSE,
ignored_at TIMESTAMP,
ignored_version TEXT
)
""")
# Sessions table (UPDATED for multi-device support)
await db.execute("""
CREATE TABLE IF NOT EXISTS sessions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_id TEXT UNIQUE NOT NULL,
device_id TEXT,
device_path TEXT,
client_ip TEXT NOT NULL,
user_agent TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_activity TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
is_active BOOLEAN DEFAULT 1
released_at TIMESTAMP,
is_active BOOLEAN DEFAULT 1,
FOREIGN KEY (device_id) REFERENCES devices(device_id)
)
""")
@@ -56,6 +80,24 @@ async def init_db():
)
""")
# Firmware flash log table (NEW for firmware update tracking)
await db.execute("""
CREATE TABLE IF NOT EXISTS firmware_flash_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
device_id TEXT NOT NULL,
device_path TEXT NOT NULL,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
old_version TEXT,
new_version TEXT,
flash_bootrom BOOLEAN DEFAULT FALSE,
success BOOLEAN,
error_message TEXT,
duration_seconds INTEGER,
user_ip TEXT,
FOREIGN KEY (device_id) REFERENCES devices(device_id)
)
""")
await db.commit()