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

Method hasSchema

src/db/queries.ts:635–643  ·  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

633 * looked for again, so a writer's later migration is seen.
634 */
635 private hasSchema(table: string, column?: string): boolean {
636 const key = column ? `${table}.${column}` : table;
637 if (this.presentSchema.has(key)) return true;
638 const found = column
639 ? this.db.prepare('SELECT 1 FROM pragma_table_info(?) WHERE name = ?').get(table, column) !== undefined
640 : this.db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined;
641 if (found) this.presentSchema.add(key);
642 return found;
643 }
644
645 /**
646 * `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