docs: schema.sql reference and DBeaver snapshot instructions

A test fails if docs/schema.sql drifts from the table server.js creates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-01 11:41:56 +08:00
1 parent b20ef0a592
commit 5bb2a7343d
3 files changed
+52 -3

No files matched your search

+10
View File
@@ -144,3 +144,13 @@ test('exits promptly on SIGTERM', async () => {
assert.ok(Date.now() - start < 2000);
fs.rmSync(tmp, { recursive: true, force: true });
});
test('docs/schema.sql matches the table the server creates', () => {
const cols = (db) => db.prepare('PRAGMA table_info(leads)').all().map((c) => [c.name, c.type, c.notnull, c.dflt_value, c.pk]);
const fromDoc = new DatabaseSync(':memory:');
fromDoc.exec(fs.readFileSync(path.join(__dirname, 'docs', 'schema.sql'), 'utf8'));
const fromServer = new DatabaseSync(dbPath, { readOnly: true });
assert.deepStrictEqual(cols(fromDoc), cols(fromServer));
fromDoc.close();
fromServer.close();
});