MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / hasSchema

Method hasSchema

src/db/queries.ts:633–641  ·  view source on GitHub ↗

* Whether the database holds `table`, or its `column`. An index an older * release built lacks what later migrations add until a writer's open * migrates it, and a read-only open migrates nothing: the CLI's read * commands and the prompt hook open read-only so that a running rebuild is *

(table: string, column?: string)

Source from the content-addressed store, hash-verified

631 * looked for again, so a writer's later migration is seen.
632 */
633 private hasSchema(table: string, column?: string): boolean {
634 const key = column ? `${table}.${column}` : table;
635 if (this.presentSchema.has(key)) return true;
636 const found = column
637 ? this.db.prepare('SELECT 1 FROM pragma_table_info(?) WHERE name = ?').get(table, column) !== undefined
638 : this.db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined;
639 if (found) this.presentSchema.add(key);
640 return found;
641 }
642
643 /**
644 * `compute()`'s answer, reused until the database changes (see

Callers 10

getSegmentNameCountsMethod · 0.95
getNamesForSegmentMethod · 0.95
getUnreferencedNodesMethod · 0.95
countGeneratedFilesMethod · 0.95

Calls 4

hasMethod · 0.80
getMethod · 0.65
prepareMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected