Files
codexis/db/queries.sql
2026-04-10 15:31:52 -04:00

26 lines
759 B
SQL

-- name: GetFileByPath :one
SELECT id, path, language, package, hash, indexed_at
FROM files
WHERE path = ?;
-- name: UpsertFile :one
INSERT INTO files (path, language, package, hash)
VALUES (?, ?, ?, ?)
ON CONFLICT(path) DO UPDATE SET
language = excluded.language,
package = excluded.package,
hash = excluded.hash,
indexed_at = CURRENT_TIMESTAMP
RETURNING id, path, language, package, hash, indexed_at;
-- name: DeleteSymbolsByFileID :exec
DELETE FROM symbols WHERE file_id = ?;
-- name: InsertSymbol :one
INSERT INTO symbols (file_id, name, kind, line, line_end, col, col_end, exported, parent_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id;
-- name: DeleteStaleFiles :exec
DELETE FROM files WHERE path NOT IN (sqlc.slice('paths'));