v0.2.11 - Picky shit

This commit is contained in:
Your Name
2025-09-06 07:12:47 -04:00
parent 6de9518de7
commit 6f51f445b7
11 changed files with 693 additions and 104 deletions

View File

@@ -197,7 +197,7 @@ AND subscription_id NOT IN (\n\
-- ================================\n\
\n\
-- Core server configuration table\n\
CREATE TABLE server_config (\n\
CREATE TABLE config (\n\
key TEXT PRIMARY KEY, -- Configuration key (unique identifier)\n\
value TEXT NOT NULL, -- Configuration value (stored as string)\n\
description TEXT, -- Human-readable description\n\
@@ -219,7 +219,7 @@ CREATE TABLE config_history (\n\
changed_by TEXT DEFAULT 'system', -- Who made the change (system/admin/user)\n\
change_reason TEXT, -- Optional reason for change\n\
changed_at INTEGER NOT NULL DEFAULT (strftime('%s', 'now')),\n\
FOREIGN KEY (config_key) REFERENCES server_config(key)\n\
FOREIGN KEY (config_key) REFERENCES config(key)\n\
);\n\
\n\
-- Configuration validation errors log\n\
@@ -244,8 +244,8 @@ CREATE TABLE config_file_cache (\n\
);\n\
\n\
-- Performance indexes for configuration tables\n\
CREATE INDEX idx_server_config_type ON server_config(config_type);\n\
CREATE INDEX idx_server_config_updated ON server_config(updated_at DESC);\n\
CREATE INDEX idx_config_type ON config(config_type);\n\
CREATE INDEX idx_config_updated ON config(updated_at DESC);\n\
CREATE INDEX idx_config_history_key ON config_history(config_key);\n\
CREATE INDEX idx_config_history_time ON config_history(changed_at DESC);\n\
CREATE INDEX idx_config_validation_key ON config_validation_log(config_key);\n\
@@ -253,14 +253,14 @@ CREATE INDEX idx_config_validation_time ON config_validation_log(attempted_at DE
\n\
-- Trigger to update timestamp on configuration changes\n\
CREATE TRIGGER update_config_timestamp\n\
AFTER UPDATE ON server_config\n\
AFTER UPDATE ON config\n\
BEGIN\n\
UPDATE server_config SET updated_at = strftime('%s', 'now') WHERE key = NEW.key;\n\
UPDATE config SET updated_at = strftime('%s', 'now') WHERE key = NEW.key;\n\
END;\n\
\n\
-- Trigger to log configuration changes to history\n\
CREATE TRIGGER log_config_changes\n\
AFTER UPDATE ON server_config\n\
AFTER UPDATE ON config\n\
WHEN OLD.value != NEW.value\n\
BEGIN\n\
INSERT INTO config_history (config_key, old_value, new_value, changed_by, change_reason)\n\
@@ -277,7 +277,7 @@ SELECT\n\
data_type,\n\
requires_restart,\n\
updated_at\n\
FROM server_config\n\
FROM config\n\
WHERE config_type IN ('system', 'user')\n\
ORDER BY config_type, key;\n\
\n\
@@ -288,7 +288,7 @@ SELECT\n\
value,\n\
description,\n\
updated_at\n\
FROM server_config\n\
FROM config\n\
WHERE config_type = 'runtime'\n\
ORDER BY key;\n\
\n\
@@ -303,7 +303,7 @@ SELECT\n\
ch.change_reason,\n\
ch.changed_at\n\
FROM config_history ch\n\
JOIN server_config sc ON ch.config_key = sc.key\n\
JOIN config sc ON ch.config_key = sc.key\n\
ORDER BY ch.changed_at DESC\n\
LIMIT 50;\n\
\n\