feature/sqlite-storage
main
把 /app/data 底下原本的 JSON 存檔,改存進 /app/data/leadboard.db(SQLite,Node 內建的 node:sqlite,沒有新增套件)。
node:sqlite
db.js
schema_migrations
documents
import_log
import-json.js
node import-json.js --dir /app/data [--dry-run | --verify-only | --force]
--force
storage.js
data-store.js
STORAGE_BACKEND=json
/api/health
storage
vibe.yaml
before-sqlite-storage
新增 tests/sqlite-storage.test.mjs(migration、原樣存取、重跑、衝突不覆蓋、整批失敗、首次啟動匯入、各 store 走資料庫);tests/server.test.mjs 改成從 leadboard.db 讀存檔。CI 全綠(測試、建置映像、容器 healthy)。
tests/sqlite-storage.test.mjs
tests/server.test.mjs
🤖 Generated with Claude Code
https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
No dependencies set.
The note is not visible to the blocked user.
做了什麼
把 /app/data 底下原本的 JSON 存檔,改存進 /app/data/leadboard.db(SQLite,Node 內建的
node:sqlite,沒有新增套件)。db.js(schema_migrations、documents、import_log;之後要改表就新增版本)。import-json.js(node import-json.js --dir /app/data [--dry-run | --verify-only | --force])。JSON 內容原樣存入,讀回後逐筆核對;重跑時相同的略過,資料庫裡內容不同的不覆蓋(要--force);任何一個檔案不是合法 JSON 就整批不寫。storage.js):成本覆寫、外包、核心參數、英文名、待生效設定、目前年度、各年在職月份、定錨、封存、手動權限、預排異動、登入狀態。data-store.js):資料庫還沒有成功的匯入紀錄時,自動把資料夾裡的 JSON 搬進去並逐筆核對;核對不過就不啟動(寧可不上線,也不顯示空資料)。STORAGE_BACKEND=json可退回舊的 JSON 檔存法;/api/health多一個storage欄位(sqlite / file / memory)。vibe.yaml的 persistence 沒有動。切換後要知道
before-sqlite-storage。測試
新增
tests/sqlite-storage.test.mjs(migration、原樣存取、重跑、衝突不覆蓋、整批失敗、首次啟動匯入、各 store 走資料庫);tests/server.test.mjs改成從 leadboard.db 讀存檔。CI 全綠(測試、建置映像、容器 healthy)。🤖 Generated with Claude Code
https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ