Update db.js

This commit is contained in:
fcarraUniSa
2026-02-17 14:28:25 +01:00
committed by GitHub
parent 3304e7d589
commit 0db1f2cea8

View File

@@ -78,6 +78,18 @@ export const initDb = async () => {
console.log("✅ Added has_been_analyzed column to tickets");
} catch (e) { /* Column likely exists */ }
// MIGRATION: Add 'attachments' to tickets if not exists
try {
await pool.query("ALTER TABLE tickets ADD COLUMN attachments JSON DEFAULT NULL");
console.log("✅ Added attachments column to tickets");
} catch (e) { /* Column likely exists */ }
// MIGRATION: Add 'attachments' to ticket_messages if not exists
try {
await pool.query("ALTER TABLE ticket_messages ADD COLUMN attachments JSON DEFAULT NULL");
console.log("✅ Added attachments column to ticket_messages");
} catch (e) { /* Column likely exists */ }
return;
}
@@ -98,7 +110,7 @@ export const initDb = async () => {
'{"appName": "OmniSupport AI", "primaryColor": "#0284c7", "logoUrl": "https://via.placeholder.com/150"}',
'{"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}]',
'{"kbEnabled": true, "maxKbArticles": 50, "maxSupervisors": 2, "aiKnowledgeAgentEnabled": true, "maxAiGeneratedArticles": 10, "maxAgents": 10}',
'{"kbEnabled": true, "maxKbArticles": 50, "maxSupervisors": 2, "aiKnowledgeAgentEnabled": true, "maxAiGeneratedArticles": 10, "maxAgents": 10, "attachmentsEnabled": true, "maxFileSizeMb": 5, "allowedFileTypes": "jpg,png,pdf"}',
'{"provider": "gemini", "apiKey": "", "model": "gemini-3-flash-preview", "isActive": true, "agentName": "OmniSupport AI", "customPrompt": ""}'
);
`;