🗄️ Database & forms — todos table, migration, seed #3

Open
opened 2026-09-28 07:55:40 +00:00 by SemianiakaVY · 0 comments
Owner

Goal — give the app a real, migrating database table for tasks so the data survives a restart.

Owner — Code Expert (w4c-code).

Deliverables

  • todos table per SPEC.md §4: id (PK), title (text, not null), done (boolean, default false), createdAt (timestamp, default now), index on (done, createdAt).
  • A migration runner and an idempotent seed script (pnpm migrate, pnpm seed), wired to DATABASE_URL (default file:./data/todos.db).
  • The DB driver must install in node:22-bookworm-slim without adding a native toolchain (prefer prebuilt binaries, e.g. better-sqlite3 or @libsql/client).
  • data/ git-ignored; .env.example documents DATABASE_URL.

Acceptance (commands)

  • On a fresh clone: pnpm install && pnpm migrate && pnpm seed → exit 0; run pnpm seed twice → row count unchanged.
  • Restart the process → the rows created before are still returned by a query on the file DB.

Ref — docs/PLAN.md §4, SPEC.md §4/§6, /db-forms is NOT used (reason: docs/PLAN.md §4).

**Goal** — give the app a real, migrating database table for tasks so the data survives a restart. **Owner** — Code Expert (`w4c-code`). **Deliverables** - `todos` table per `SPEC.md` §4: `id` (PK), `title` (text, not null), `done` (boolean, default false), `createdAt` (timestamp, default now), index on `(done, createdAt)`. - A migration runner and an **idempotent** seed script (`pnpm migrate`, `pnpm seed`), wired to `DATABASE_URL` (default `file:./data/todos.db`). - The DB driver must install in `node:22-bookworm-slim` without adding a native toolchain (prefer prebuilt binaries, e.g. `better-sqlite3` or `@libsql/client`). - `data/` git-ignored; `.env.example` documents `DATABASE_URL`. **Acceptance (commands)** - On a fresh clone: `pnpm install && pnpm migrate && pnpm seed` → exit 0; run `pnpm seed` twice → row count unchanged. - Restart the process → the rows created before are still returned by a query on the file DB. **Ref** — `docs/PLAN.md` §4, `SPEC.md` §4/§6, `/db-forms` is NOT used (reason: `docs/PLAN.md` §4).
SemianiakaVY added the
High Priority
label 2026-09-28 07:55:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: SemianiakaVY/todo-list#3
No description provided.