* Leave bulk-edge-load mode: recreate the dropped indexes in one pass each * over the (now fully loaded) edges table — far cheaper than maintaining * them per-insert. DDL is extracted from schema.sql so it cannot drift. * * Async with a yield BETWEEN the four CREATE INDEX statements: eac
()
| 309 | * stays inside the window. |
| 310 | */ |
| 311 | async endBulkEdgeLoad(): Promise<void> { |
| 312 | const schemaPath = path.join(__dirname, 'schema.sql'); |
| 313 | const schema = fs.readFileSync(schemaPath, 'utf-8'); |
| 314 | for (const idx of DatabaseConnection.BULK_EDGE_INDEX_NAMES) { |
| 315 | const m = schema.match(new RegExp(`CREATE INDEX IF NOT EXISTS ${idx}\\b[^;]*;`)); |
| 316 | if (!m) throw new Error(`schema.sql: edge index ${idx} not found for bulk-load recreation`); |
| 317 | this.db.exec(m[0]); |
| 318 | await new Promise((resolve) => setImmediate(resolve)); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | /** Recreate the FTS triggers + rebuild if a bulk-load window never closed. */ |
| 323 | private healBulkNodeLoad(): void { |
no test coverage detected