fix: Schema compatibility - emoji → icon column rename

Production Outline DB uses 'icon' column instead of 'emoji' for documents
and revisions. Fixed all affected queries:

- documents.ts: SELECT queries
- advanced-search.ts: Search queries
- analytics.ts: Analytics + GROUP BY
- export-import.ts: Export/import metadata
- templates.ts: Template queries + INSERT
- collections.ts: Collection document listing
- revisions.ts: Revision comparison

reactions.emoji kept unchanged (correct schema)

Tested: 448 documents successfully queried from hub.descomplicar.pt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 17:14:27 +00:00
parent 5f49cb63e8
commit 7d2a014b74
10 changed files with 63 additions and 37 deletions

View File

@@ -40,7 +40,7 @@ const listTemplates: BaseTool<TemplateListArgs> = {
const result = await pgClient.query(`
SELECT
d.id, d.title, d.emoji, d."collectionId", d."createdById",
d.id, d.title, d.icon, d."collectionId", d."createdById",
d."createdAt", d."updatedAt",
c.name as "collectionName",
u.name as "createdByName",
@@ -131,7 +131,7 @@ const createFromTemplate: BaseTool<{ template_id: string; title: string; collect
// Create document from template
const result = await pgClient.query(`
INSERT INTO documents (
id, title, text, emoji, "collectionId", "teamId", "parentDocumentId",
id, title, text, icon, "collectionId", "teamId", "parentDocumentId",
"templateId", "createdById", "lastModifiedById", template,
"createdAt", "updatedAt"
)
@@ -142,7 +142,7 @@ const createFromTemplate: BaseTool<{ template_id: string; title: string; collect
`, [
sanitizeInput(args.title),
t.text,
t.emoji,
t.icon,
args.collection_id || t.collectionId,
t.teamId,
args.parent_document_id || null,