Skip to content

[schemas] Reading list with ratings and review metadata - #444

Open
kaizengrowth wants to merge 1 commit into
NateBJones-Projects:mainfrom
kaizengrowth:contrib/kaizengrowth/reading-list-schema
Open

[schemas] Reading list with ratings and review metadata#444
kaizengrowth wants to merge 1 commit into
NateBJones-Projects:mainfrom
kaizengrowth:contrib/kaizengrowth/reading-list-schema

Conversation

@kaizengrowth

@kaizengrowth kaizengrowth commented Jul 13, 2026

Copy link
Copy Markdown

Fixes #16

Contribution Type

  • Recipe (/recipes)
  • Schema (/schemas)
  • Dashboard (/dashboards)
  • Integration (/integrations)
  • Skill (/skills)
  • Repo improvement (docs, CI, templates)

What does this do?

Adds the reading-list schema that was listed as planned in schemas/README.md: a standalone reading_list table for tracking books, articles, podcasts, and videos through want_to_read → reading → finished (plus abandoned), with a 1–5 rating, review notes, url, start/finish dates, and JSONB tags — all the fields recommended in the issue.

Beyond the table itself:

  • CHECK constraints on type, status, rating (1–5), and date ordering (finished_date can't precede started_date)
  • Five indexes for the common access patterns: status, type, rating (partial), tag containment (GIN), and finish-date timeline (partial)
  • updated_at touch trigger so edits keep the timestamp fresh
  • currently_reading view for the shelf you check most often
  • RLS: included as a commented optional block. The standard Open Brain setup accesses tables with the service role key (which bypasses RLS), so RLS defaults off — matching the core thoughts table and the readwise-books schema precedent. The README explains when to enable it.

The migration is fully idempotent and does not touch the core thoughts table. Also updates schemas/README.md: adds the schema to the catalog table and removes the fulfilled entry from the Ideas list.

Design note: abandoned is included alongside the three statuses from the issue — DNF-ing is a real reading outcome, and adding it later would mean an ALTER for everyone. The README's troubleshooting section shows how to extend the status list if you want more (e.g. on_hold).

Tested: applied against Postgres 16 twice in a row (idempotency), verified the trigger updates updated_at, the view returns in-progress items, and all four constraint classes reject invalid rows.

Requirements

No external services or tools — just the Supabase SQL Editor (or CLI) from a working Open Brain setup.

Checklist

  • I've read CONTRIBUTING.md
  • My contribution has a README.md with prerequisites, step-by-step instructions, and expected outcome
  • My metadata.json has all required fields
  • If my contribution depends on a skill or primitive, I declared it in metadata.json and linked it in the README — N/A, no dependencies
  • I tested this on my own Open Brain instance — specifically: applied twice against a clean Postgres 16 (idempotency), then exercised the trigger, view, and all four constraint classes with real inserts/updates
  • No credentials, API keys, or secrets are included

Implements the reading list planned in the schemas README (issue NateBJones-Projects#16):
a standalone reading_list table for books, articles, podcasts, and
videos with want_to_read/reading/finished/abandoned status, 1-5
ratings, review notes, start/finish dates, and JSONB tags.

Includes CHECK constraints on type/status/rating/date ordering, five
indexes for the common filters, an updated_at touch trigger, a
currently_reading view, and a commented optional RLS block. Fully
idempotent; does not touch the core thoughts table.

Verified against Postgres 16: migration applied twice cleanly, trigger
and view behave, and all four constraints reject invalid rows.
@github-actions github-actions Bot added the schema Contribution: database extension label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

schema Contribution: database extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema: Reading list with ratings and review metadata

1 participant