Update schema.sql
This commit is contained in:
@@ -66,13 +66,14 @@ CREATE TABLE tickets (
|
|||||||
queue VARCHAR(50),
|
queue VARCHAR(50),
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
attachments JSON DEFAULT NULL, -- Array di oggetti Attachment
|
attachments JSON DEFAULT NULL, -- Array di oggetti Attachment
|
||||||
|
has_been_analyzed BOOLEAN DEFAULT FALSE, -- Flag per l'agente AI
|
||||||
FOREIGN KEY (assigned_agent_id) REFERENCES agents(id) ON DELETE SET NULL
|
FOREIGN KEY (assigned_agent_id) REFERENCES agents(id) ON DELETE SET NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO tickets (id, subject, description, status, priority, customer_name, assigned_agent_id, queue, created_at) VALUES
|
INSERT INTO tickets (id, subject, description, status, priority, customer_name, assigned_agent_id, queue, created_at, has_been_analyzed) VALUES
|
||||||
('T-1001', 'Problema connessione VPN', 'Non riesco a connettermi alla VPN aziendale da casa.', 'APERTO', 'Alta', 'Luca Verdi', NULL, 'Tech Support', '2023-12-01 09:00:00'),
|
('T-1001', 'Problema connessione VPN', 'Non riesco a connettermi alla VPN aziendale da casa.', 'APERTO', 'Alta', 'Luca Verdi', NULL, 'Tech Support', '2023-12-01 09:00:00', FALSE),
|
||||||
('T-1002', 'Errore Fattura Dicembre', 'La fattura riporta un importo errato rispetto al contratto.', 'RISOLTO', 'Media', 'Anna Neri', 'a2', 'Billing', '2023-11-28 14:30:00'),
|
('T-1002', 'Errore Fattura Dicembre', 'La fattura riporta un importo errato rispetto al contratto.', 'RISOLTO', 'Media', 'Anna Neri', 'a2', 'Billing', '2023-11-28 14:30:00', TRUE),
|
||||||
('T-1003', 'Come configurare 2FA', 'Vorrei attivare la doppia autenticazione ma non trovo l''opzione.', 'RISOLTO', 'Bassa', 'Giorgio Gialli', 'a1', 'Tech Support', '2023-11-25 10:00:00');
|
('T-1003', 'Come configurare 2FA', 'Vorrei attivare la doppia autenticazione ma non trovo l''opzione.', 'RISOLTO', 'Bassa', 'Giorgio Gialli', 'a1', 'Tech Support', '2023-11-25 10:00:00', TRUE);
|
||||||
|
|
||||||
-- 5. TABELLA TICKET_MESSAGES (Messaggi della chat del ticket)
|
-- 5. TABELLA TICKET_MESSAGES (Messaggi della chat del ticket)
|
||||||
DROP TABLE IF EXISTS ticket_messages;
|
DROP TABLE IF EXISTS ticket_messages;
|
||||||
@@ -102,13 +103,14 @@ CREATE TABLE kb_articles (
|
|||||||
type ENUM('article', 'url') DEFAULT 'article',
|
type ENUM('article', 'url') DEFAULT 'article',
|
||||||
url TEXT,
|
url TEXT,
|
||||||
source ENUM('manual', 'ai') DEFAULT 'manual',
|
source ENUM('manual', 'ai') DEFAULT 'manual',
|
||||||
|
visibility ENUM('public', 'internal') DEFAULT 'public', -- Visibilità
|
||||||
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO kb_articles (id, title, content, category, type, url, source, last_updated) VALUES
|
INSERT INTO kb_articles (id, title, content, category, type, url, source, visibility, last_updated) VALUES
|
||||||
('kb1', 'Come reimpostare la password', 'Per reimpostare la password, vai su Impostazioni > Sicurezza e clicca su "Cambia Password". Ti verrà inviata una mail di conferma.', 'Account', 'article', NULL, 'manual', '2023-10-15 10:00:00'),
|
('kb1', 'Come reimpostare la password', 'Per reimpostare la password, vai su Impostazioni > Sicurezza e clicca su "Cambia Password". Ti verrà inviata una mail di conferma.', 'Account', 'article', NULL, 'manual', 'public', '2023-10-15 10:00:00'),
|
||||||
('kb2', 'Configurazione Email su Outlook', '1. Apri Outlook. 2. File > Aggiungi Account. 3. Inserisci la tua mail. 4. Seleziona IMAP. Server in entrata: imap.example.com porta 993.', 'Tecnico', 'article', NULL, 'manual', '2023-11-02 11:30:00'),
|
('kb2', 'Configurazione Email su Outlook', '1. Apri Outlook. 2. File > Aggiungi Account. 3. Inserisci la tua mail. 4. Seleziona IMAP. Server in entrata: imap.example.com porta 993.', 'Tecnico', 'article', NULL, 'manual', 'public', '2023-11-02 11:30:00'),
|
||||||
('kb3', 'Documentazione API Ufficiale', 'Riferimento esterno alla documentazione.', 'Sviluppo', 'url', 'https://example.com/api-docs', 'manual', '2023-09-20 09:00:00');
|
('kb3', 'Documentazione API Ufficiale', 'Riferimento esterno alla documentazione.', 'Sviluppo', 'url', 'https://example.com/api-docs', 'manual', 'public', '2023-09-20 09:00:00');
|
||||||
|
|
||||||
-- 7. TABELLA SURVEY_RESULTS (Feedback e Sondaggi)
|
-- 7. TABELLA SURVEY_RESULTS (Feedback e Sondaggi)
|
||||||
DROP TABLE IF EXISTS survey_results;
|
DROP TABLE IF EXISTS survey_results;
|
||||||
@@ -144,7 +146,7 @@ INSERT INTO settings (id, branding, smtp, email_templates, features, ai_config)
|
|||||||
'{"host": "smtp.example.com", "port": 587, "user": "notifications@omnisupport.ai", "pass": "password", "secure": true, "fromEmail": "noreply@omnisupport.ai"}',
|
'{"host": "smtp.example.com", "port": 587, "user": "notifications@omnisupport.ai", "pass": "password", "secure": true, "fromEmail": "noreply@omnisupport.ai"}',
|
||||||
'[{"id": "t1", "name": "Conferma Apertura Ticket", "trigger": "ticket_created", "audience": "client", "subject": "Ticket #{ticket_id} Creato", "body": "Grazie per averci contattato.", "isActive": true}]',
|
'[{"id": "t1", "name": "Conferma Apertura Ticket", "trigger": "ticket_created", "audience": "client", "subject": "Ticket #{ticket_id} Creato", "body": "Grazie per averci contattato.", "isActive": true}]',
|
||||||
'{"kbEnabled": true, "maxKbArticles": 50, "maxSupervisors": 2, "aiKnowledgeAgentEnabled": true, "maxAiGeneratedArticles": 10, "maxAgents": 10}',
|
'{"kbEnabled": true, "maxKbArticles": 50, "maxSupervisors": 2, "aiKnowledgeAgentEnabled": true, "maxAiGeneratedArticles": 10, "maxAgents": 10}',
|
||||||
'{"provider": "gemini", "apiKey": "", "model": "gemini-3-flash-preview", "isActive": true}'
|
'{"provider": "gemini", "apiKey": "", "model": "gemini-3-flash-preview", "isActive": true, "agentName": "OmniSupport AI", "customPrompt": ""}'
|
||||||
);
|
);
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user