From e360ec2c30b1f76a1f0f956f4ec13a9b4b539539 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Mon, 9 Feb 2026 20:09:29 -0500 Subject: [PATCH] feat(db): add system_settings table and remove per-user scan settings - Add system_settings table with id, setting_key, setting_value, description, updated_at - Insert default settings: scan_frequency_minutes=60, auto_scan_enabled=true - Remove scan_frequency_minutes and auto_scan_enabled from users table - Migrate from per-user scan settings to system-wide settings This change enables centralized scan configuration for all libraries while removing individual user scan preferences. Database schema changes require container recreation: podman compose down -v podman compose up -d --- database/schema/schema.sql | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/database/schema/schema.sql b/database/schema/schema.sql index 27f0f5e..71e2f1a 100644 --- a/database/schema/schema.sql +++ b/database/schema/schema.sql @@ -26,13 +26,25 @@ CREATE TABLE users ( last_name VARCHAR(255), role VARCHAR(20) NOT NULL DEFAULT 'user' CHECK (role IN ('admin', 'user')), theme VARCHAR(50) DEFAULT 'tokyo-night', - scan_frequency_minutes INTEGER DEFAULT 60, - auto_scan_enabled BOOLEAN DEFAULT true, max_devices INTEGER DEFAULT 10, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() ); +-- Create system_settings table +CREATE TABLE system_settings ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + setting_key VARCHAR(100) UNIQUE NOT NULL, + setting_value TEXT NOT NULL, + description TEXT, + updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() +); + +-- Insert default system settings +INSERT INTO system_settings (setting_key, setting_value, description) VALUES +('scan_frequency_minutes', '60', 'How often to scan all libraries in minutes'), +('auto_scan_enabled', 'true', 'Whether auto-scanning is enabled system-wide'); + -- Create refresh_tokens table CREATE TABLE refresh_tokens ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(),