From 7476e61d0b6bcc515442f622e1ce72cae33e7b75 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev Date: Tue, 2 Jun 2026 09:25:52 +0700 Subject: [PATCH] Bootstrap geo graph collections --- src/db.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/db.ts b/src/db.ts index 845540c..24cb0a9 100644 --- a/src/db.ts +++ b/src/db.ts @@ -17,6 +17,19 @@ export function getDb(): Database { export async function ensureGraph(): Promise { const db = getDb() + + const nodes = db.collection('nodes') + if (!(await nodes.exists())) { + console.log('Creating collection: nodes') + await db.createCollection('nodes') + } + + const edges = db.collection('edges') + if (!(await edges.exists())) { + console.log('Creating edge collection: edges') + await db.createEdgeCollection('edges') + } + const graphs = await db.listGraphs() if (graphs.some(g => g.name === 'optovia_graph')) return