Commit graph

4 commits

Author SHA1 Message Date
DESKTOP-1R2VSQH\Lenovo ThinkPad E490
79c9e2cc41 Seed ไฟล์ตัวอย่างแบบ idempotent sync กับ public/samples/
- scripts/seed-samples.mjs: INSERT ไฟล์ที่ยังไม่มี row + DELETE row ที่ไฟล์หาย
  (CASCADE ลบ annotation ตาม) — แทน SQL seed มือเดิมใน README
- รันอัตโนมัติตอน container start ต่อจาก migrate + npm run seed-samples บนเครื่อง dev
- สลับไฟล์ sample เป็นคำสั่งศาล 2 ฉบับ

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-10 18:01:25 +07:00
DESKTOP-1R2VSQH\Lenovo ThinkPad E490
ec26d79f0e Fix migrate ตอน start: standalone node_modules ไม่มี package postgres
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 46s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 3s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 1s
Next บีบ bundle postgres.js เข้า server chunks ทำให้ /app/node_modules
ของ standalone ไม่มี package นี้ — migrate.mjs import ไม่เจอ (ERR_MODULE_NOT_FOUND)
แก้โดย COPY package postgres จาก stage deps (v3.4.9 ไม่มี dependency ย่อย)

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-10 16:30:01 +07:00
DESKTOP-1R2VSQH\Lenovo ThinkPad E490
60658568f7 Auto-migrate ตอน container start (แทนการ push มือ)
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 44s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 3s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 0s
- scripts/migrate.mjs: สร้าง database ถ้ายังไม่มี + apply ไฟล์
  drizzle/*.sql ที่ยังไม่อยู่ในตาราง _migrations (ทีละไฟล์ใน
  transaction, แยก statement ด้วย --> statement-breakpoint)
  — เจอ schema ที่สร้างไว้ก่อนแล้ว (42P07/42710/42701) ถือว่า applied
- web.Dockerfile: ฝัง drizzle/ + scripts/ ใน image,
  CMD รัน migrate ก่อน node server.js
- .dockerignore: เอา drizzle ออก (ต้องขึ้น image)
- commit ไฟล์ migration แรก drizzle/0000 (จาก drizzle-kit generate)

ทดสอบบน PostgreSQL 17 แล้ว 3 เคส: สร้างใหม่ / รันซ้ำ / schema
มีอยู่ก่อนแบบไม่มี _migrations (เคส server ปัจจุบัน) — ผ่านทั้งหมด

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-10 16:25:14 +07:00
DESKTOP-1R2VSQH\Lenovo ThinkPad E490
83108dd16c Add Forgejo CD workflow + Docker image build
Some checks failed
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 53s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Failing after 1s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Failing after 1s
- .forgejo/workflows/build.yml: ดัดแปลงจาก e-Ticket — validate db/schema.ts
  (Drizzle) แทน Prisma migrations, image chamomind/ecourt-note,
  deploy ผ่าน SSH (ECOURT_NOTE_TAG), แก้ env ที่ใช้แต่ไม่ได้นิยาม
  (NEXT_PUBLIC_APP_URL) และ vars/secrets.SSH_DEPLOY_USER ไม่สอดคล้อง
- docker/web.Dockerfile: Next.js standalone 3 stages (deps/build/runner)
  พร้อม build-time DATABASE_URL placeholder (db/index.ts throw ถ้าไม่มี env
  ตอนเก็บ page data) + COPY .next/static ที่ standalone ไม่รวม
- .dockerignore กัน .git/node_modules/.next/.env เข้า build context
- next.config.mjs: เปิด output: "standalone"

หมายเหตุ: ยังตรวจ docker build ท้องถิ่นไม่ครบ — ค้างที่ดิสก์ C: เต็ม
(Docker Desktop buildkit read-only) รอเคลียร์พื้นที่ก่อน rerun

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-10 15:43:17 +07:00