feat(postgres): implement notes CRUD and include notes in export/import #15

Closed
opened 2026-07-23 01:51:52 +02:00 by codinget · 0 comments
Owner

Summary

The postgres backend does not implement notes: every note method on PostgresInterface (listNotes, getNoteById, deleteNoteById, createNote, updateNote, listNotesByAbodeId, listNotesByUserId) throws Error("Unimplemented"), even though the notes table exists in the pg migrations (3.notes) and the sqlite backend implements the full CRUD.

Impact on export/import (PR #13)

Because notes are unimplemented on postgres, the export/import support added in #13 skips the note kind on the postgres backend:

  • PostgresInterface.export() omits notes from the stream (a pg database holds none anyway).
  • PostgresInterface.import() silently drops any note lines in an incoming dump (they are not counted in the import summary).

So a full sqlite→postgres migration currently carries users/abodes/residents/apikeys but loses notes. This is the only sane behaviour until postgres can represent notes, but it should be closed out.

Scope

  1. Implement notes CRUD on PostgresInterface, matching the sqlite semantics (see SqliteInterface + src/db/postgres/query.ts for the selectNote(s)/selectPartialNotes helpers to add).
  2. Wire note into postgres export/import: add it to the export tables list and drop the if (parsed.kind === "note") continue; skip in import(); add an #importRecord note case (mirroring the sqlite one).
  3. Extend coverage (fake-client tests here, and the real-pg round-trip once #8's CI postgres exists) to assert notes now survive a round-trip.

Related

  • #13 (export/import) — introduced the note-skip this removes.
  • #8 (test: cover notes CRUD and the PostgreSQL backend) — the CI-postgres harness that would let a real note round-trip be tested.
## Summary The postgres backend does not implement notes: every note method on `PostgresInterface` (`listNotes`, `getNoteById`, `deleteNoteById`, `createNote`, `updateNote`, `listNotesByAbodeId`, `listNotesByUserId`) throws `Error("Unimplemented")`, even though the `notes` table exists in the pg migrations (`3.notes`) and the sqlite backend implements the full CRUD. ## Impact on export/import (PR #13) Because notes are unimplemented on postgres, the export/import support added in #13 **skips the `note` kind on the postgres backend**: - `PostgresInterface.export()` omits notes from the stream (a pg database holds none anyway). - `PostgresInterface.import()` silently drops any `note` lines in an incoming dump (they are not counted in the import summary). So a full sqlite→postgres migration currently carries users/abodes/residents/apikeys but **loses notes**. This is the only sane behaviour until postgres can represent notes, but it should be closed out. ## Scope 1. Implement notes CRUD on `PostgresInterface`, matching the sqlite semantics (see `SqliteInterface` + `src/db/postgres/query.ts` for the `selectNote(s)`/`selectPartialNotes` helpers to add). 2. Wire `note` into postgres export/import: add it to the export `tables` list and drop the `if (parsed.kind === "note") continue;` skip in `import()`; add an `#importRecord` `note` case (mirroring the sqlite one). 3. Extend coverage (fake-client tests here, and the real-pg round-trip once #8's CI postgres exists) to assert notes now survive a round-trip. ## Related - #13 (export/import) — introduced the note-skip this removes. - #8 (test: cover notes CRUD and the PostgreSQL backend) — the CI-postgres harness that would let a real note round-trip be tested.
codinget added the
Priority
Medium
3
Kind/Feature
Agent
Opus
Agentic
labels 2026-07-23 01:51:52 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: codinget/abode#15