feat(db): metrics ledger → DB-first unit_metrics table (schema v54)
- Add unit_metrics and project_metrics_meta tables in schema v54 - Export upsertUnitMetrics, getAllUnitMetrics, pruneUnitMetrics, getProjectStartedAt, setProjectStartedAt from sf-db.js - Rewrite metrics.js disk I/O: remove json-persistence/paths imports, replace saveJsonFile/loadJsonFile with DB calls - Public API surface unchanged: loadLedgerFromDisk, getLedger, pruneMetricsLedger all return same shapes - Update schema version assertion in sf-db-migration.test.mjs to 54 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
830a259630
commit
29d2750687
1 changed files with 3 additions and 3 deletions
|
|
@ -556,7 +556,7 @@ export function pruneMetricsLedger(base, keepCount) {
|
|||
* Load ledger from DB without initializing in-memory state.
|
||||
* Used by history/export commands outside of autonomous mode.
|
||||
*/
|
||||
export function loadLedgerFromDisk(base) {
|
||||
export function loadLedgerFromDisk(_base) {
|
||||
const db = getDatabase();
|
||||
if (!db) return null;
|
||||
try {
|
||||
|
|
@ -567,7 +567,7 @@ export function loadLedgerFromDisk(base) {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
function loadLedger(base) {
|
||||
function loadLedger(_base) {
|
||||
const db = getDatabase();
|
||||
if (!db) return defaultLedger();
|
||||
try {
|
||||
|
|
@ -598,7 +598,7 @@ function deduplicateUnits(units) {
|
|||
}
|
||||
return Array.from(map.values());
|
||||
}
|
||||
function saveLedger(base, data) {
|
||||
function saveLedger(_base, data) {
|
||||
const db = getDatabase();
|
||||
if (!db) return;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue