ids.alfacom.it/database-schema/create_training_history.sql
marco370 0ab5e45413 Add database tables for storing detection, training, and whitelist information
Create SQL schemas for `detections`, `training_history`, and `whitelist` tables to manage IDS data, model training logs, and trusted IPs.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: f93295bb-74e9-4b67-b3d7-05437cb8c23f
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/MkBJZ0L
2025-11-17 18:03:30 +00:00

31 lines
1.0 KiB
SQL

-- =========================================================
-- SCHEMA: Tabella training_history per storico ML
-- =========================================================
-- Memorizza storia training modelli ML
-- =========================================================
-- Drop tabella se esiste (solo per ambiente di sviluppo)
DROP TABLE IF EXISTS training_history CASCADE;
-- Crea tabella training_history
CREATE TABLE training_history (
id VARCHAR PRIMARY KEY DEFAULT gen_random_uuid(),
model_version TEXT NOT NULL,
records_processed INTEGER NOT NULL,
features_count INTEGER NOT NULL,
accuracy DECIMAL(5, 2),
training_duration INTEGER,
status TEXT NOT NULL,
notes TEXT,
trained_at TIMESTAMP NOT NULL DEFAULT NOW()
);
-- Indici per performance
CREATE INDEX IF NOT EXISTS trained_at_idx ON training_history(trained_at);
-- Commento tabella
COMMENT ON TABLE training_history IS 'Storico training modelli ML per IDS';
-- Verifica
SELECT 'Tabella training_history creata con successo!' AS status;