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:
@@ -21,7 +21,7 @@ interface ImportMarkdownArgs {
|
||||
title: string;
|
||||
content: string;
|
||||
parent_path?: string;
|
||||
emoji?: string;
|
||||
icon?: string;
|
||||
}>;
|
||||
create_hierarchy?: boolean;
|
||||
}
|
||||
@@ -62,7 +62,7 @@ const exportCollectionToMarkdown: BaseTool<ExportCollectionArgs> = {
|
||||
const documents = await pgClient.query(`
|
||||
WITH RECURSIVE doc_tree AS (
|
||||
SELECT
|
||||
d.id, d.title, d.text, d.emoji, d."parentDocumentId",
|
||||
d.id, d.title, d.text, d.icon, d."parentDocumentId",
|
||||
d."createdAt", d."updatedAt", d."publishedAt",
|
||||
u.name as "authorName",
|
||||
0 as depth,
|
||||
@@ -77,7 +77,7 @@ const exportCollectionToMarkdown: BaseTool<ExportCollectionArgs> = {
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
d.id, d.title, d.text, d.emoji, d."parentDocumentId",
|
||||
d.id, d.title, d.text, d.icon, d."parentDocumentId",
|
||||
d."createdAt", d."updatedAt", d."publishedAt",
|
||||
u.name as "authorName",
|
||||
dt.depth + 1,
|
||||
@@ -111,7 +111,7 @@ const exportCollectionToMarkdown: BaseTool<ExportCollectionArgs> = {
|
||||
if (includeMetadata) {
|
||||
content += '---\n';
|
||||
content += `title: "${doc.title.replace(/"/g, '\\"')}"\n`;
|
||||
if (doc.emoji) content += `emoji: "${doc.emoji}"\n`;
|
||||
if (doc.icon) content += `icon: "${doc.icon}"\n`;
|
||||
content += `author: "${doc.authorName || 'Unknown'}"\n`;
|
||||
content += `created: ${doc.createdAt}\n`;
|
||||
content += `updated: ${doc.updatedAt}\n`;
|
||||
@@ -122,7 +122,7 @@ const exportCollectionToMarkdown: BaseTool<ExportCollectionArgs> = {
|
||||
|
||||
// Add title as H1 if not already in content
|
||||
if (!doc.text?.startsWith('# ')) {
|
||||
content += `# ${doc.emoji ? doc.emoji + ' ' : ''}${doc.title}\n\n`;
|
||||
content += `# ${doc.icon ? doc.icon + ' ' : ''}${doc.title}\n\n`;
|
||||
}
|
||||
|
||||
content += doc.text || '';
|
||||
@@ -171,7 +171,7 @@ const importMarkdownFolder: BaseTool<ImportMarkdownArgs> = {
|
||||
title: { type: 'string', description: 'Document title' },
|
||||
content: { type: 'string', description: 'Markdown content' },
|
||||
parent_path: { type: 'string', description: 'Parent document path (e.g., "parent/child")' },
|
||||
emoji: { type: 'string', description: 'Document emoji' },
|
||||
icon: { type: 'string', description: 'Document icon' },
|
||||
},
|
||||
required: ['title', 'content'],
|
||||
},
|
||||
@@ -256,7 +256,7 @@ const importMarkdownFolder: BaseTool<ImportMarkdownArgs> = {
|
||||
// Create document
|
||||
const result = await client.query(`
|
||||
INSERT INTO documents (
|
||||
id, title, text, emoji, "collectionId", "teamId", "parentDocumentId",
|
||||
id, title, text, icon, "collectionId", "teamId", "parentDocumentId",
|
||||
"createdById", "lastModifiedById", template, "createdAt", "updatedAt"
|
||||
)
|
||||
VALUES (
|
||||
@@ -266,7 +266,7 @@ const importMarkdownFolder: BaseTool<ImportMarkdownArgs> = {
|
||||
`, [
|
||||
sanitizeInput(doc.title),
|
||||
content,
|
||||
doc.emoji || null,
|
||||
doc.icon || null,
|
||||
args.collection_id,
|
||||
teamId,
|
||||
parentDocumentId,
|
||||
|
||||
Reference in New Issue
Block a user