feat(storage): move project data to SQLite via node:sqlite
- server/db.mjs: schema (site + projects), transactional replace, WAL, VACUUM INTO backups (keep 10), JSON export, first-run seed from data/projects.json - publish.mjs: read/write through the database, export mirror JSON for git/static/offline, validate duplicate project_id - ui/data.js: read live data from /api/projects first, fall back to data/projects.json - Dockerfile/compose/.env.example: DB_PATH, drop experimental sqlite warning flag - docs: AGENTS.md + README describe the database layer and traps
This commit is contained in:
1 parent
830dba58ec
commit
5fb095b872
11 files changed
+364
-61
No files matched your search
+2
-2
@@ -512,10 +512,10 @@ export function adminView(ctx) {
|
||||
statusEl.dataset.state = "ok";
|
||||
textEl.textContent = "พร้อมเผยแพร่ผ่านเซิร์ฟเวอร์";
|
||||
extraEl.textContent = apiState.writable
|
||||
? "บันทึกลง data/projects.json ได้ทันที"
|
||||
? "บันทึกลงฐานข้อมูล SQLite ได้ทันที"
|
||||
: "อ่านได้ แต่เขียนไม่ได้ (ตรวจรหัสเผยแพร่)";
|
||||
hintEl.innerHTML =
|
||||
"กด “เผยแพร่” แล้วไฟล์ <code>data/projects.json</code> จะถูกเขียนทับและ commit ขึ้น Git ให้อัตโนมัติ";
|
||||
"กด “เผยแพร่” แล้วข้อมูลจะถูกบันทึกลงฐานข้อมูล SQLite (<code>data/hobbypj.sqlite</code>) พร้อม export <code>data/projects.json</code> และ commit ขึ้น Git ให้อัตโนมัติ";
|
||||
} else if (ctx.source === "cache") {
|
||||
statusEl.dataset.state = "warn";
|
||||
textEl.textContent = "เปิดแบบออฟไลน์ — เห็นข้อมูลที่แคชไว้";
|
||||
|
||||
Reference in new issue
Block a user