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

Method upsertFile

src/db/queries.ts:1865–1891  ·  view source on GitHub ↗

* Insert or update a file record

(file: FileRecord)

Source from the content-addressed store, hash-verified

1863 * Insert or update a file record
1864 */
1865 upsertFile(file: FileRecord): void {
1866 if (!this.stmts.upsertFile) {
1867 this.stmts.upsertFile = this.db.prepare(`
1868 INSERT INTO files (path, content_hash, language, size, modified_at, indexed_at, node_count, errors)
1869 VALUES (@path, @contentHash, @language, @size, @modifiedAt, @indexedAt, @nodeCount, @errors)
1870 ON CONFLICT(path) DO UPDATE SET
1871 content_hash = @contentHash,
1872 language = @language,
1873 size = @size,
1874 modified_at = @modifiedAt,
1875 indexed_at = @indexedAt,
1876 node_count = @nodeCount,
1877 errors = @errors
1878 `);
1879 }
1880
1881 this.stmts.upsertFile.run({
1882 path: file.path,
1883 contentHash: file.contentHash,
1884 language: file.language,
1885 size: file.size,
1886 modifiedAt: file.modifiedAt,
1887 indexedAt: file.indexedAt,
1888 nodeCount: file.nodeCount,
1889 errors: file.errors ? JSON.stringify(file.errors) : null,
1890 });
1891 }
1892
1893 /**
1894 * Delete a file record and its nodes

Callers 2

storeFileBundleMethod · 0.95
storeExtractionResultMethod · 0.80

Calls 2

prepareMethod · 0.65
runMethod · 0.65

Tested by

no test coverage detected