fix: Skip FTS5 validation for sql.js databases in Docker

Resolves Docker test failures where sql.js databases (which don't
support FTS5) were failing validation checks. The validateDatabaseHealth()
method now checks FTS5 support before attempting FTS5 table queries.

Changes:
- Check db.checkFTS5Support() before FTS5 table validation
- Log warning for sql.js databases instead of failing
- Allows Docker containers using sql.js to start successfully

Fixes: Docker entrypoint integration tests
Related: feature/session-persistence-phase-1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-10-12 21:42:26 +02:00
parent 66cb66b31b
commit ee99cb7ba1

View File

@@ -285,18 +285,26 @@ export class N8NDocumentationMCPServer {
throw new Error('Database is empty. Run "npm run rebuild" to populate node data.'); throw new Error('Database is empty. Run "npm run rebuild" to populate node data.');
} }
// Check if FTS5 table exists // Check FTS5 support before attempting FTS5 queries
const ftsExists = this.db.prepare(` // sql.js doesn't support FTS5, so we need to skip FTS5 validation for sql.js databases
SELECT name FROM sqlite_master const hasFTS5 = this.db.checkFTS5Support();
WHERE type='table' AND name='nodes_fts'
`).get();
if (!ftsExists) { if (!hasFTS5) {
logger.warn('FTS5 table missing - search performance will be degraded. Please run: npm run rebuild'); logger.warn('FTS5 not supported (likely using sql.js) - search will use basic queries');
} else { } else {
const ftsCount = this.db.prepare('SELECT COUNT(*) as count FROM nodes_fts').get() as { count: number }; // Only check FTS5 table if FTS5 is supported
if (ftsCount.count === 0) { const ftsExists = this.db.prepare(`
logger.warn('FTS5 index is empty - search will not work properly. Please run: npm run rebuild'); SELECT name FROM sqlite_master
WHERE type='table' AND name='nodes_fts'
`).get();
if (!ftsExists) {
logger.warn('FTS5 table missing - search performance will be degraded. Please run: npm run rebuild');
} else {
const ftsCount = this.db.prepare('SELECT COUNT(*) as count FROM nodes_fts').get() as { count: number };
if (ftsCount.count === 0) {
logger.warn('FTS5 index is empty - search will not work properly. Please run: npm run rebuild');
}
} }
} }