Skip to content

[schemas] Make enhanced-thoughts self-contained for status columns#305

Merged
justfinethanku merged 2 commits into
NateBJones-Projects:mainfrom
lucifer:contrib/lucifer/enhanced-thoughts-status-columns
Jun 4, 2026
Merged

[schemas] Make enhanced-thoughts self-contained for status columns#305
justfinethanku merged 2 commits into
NateBJones-Projects:mainfrom
lucifer:contrib/lucifer/enhanced-thoughts-status-columns

Conversation

@lucifer

@lucifer lucifer commented May 15, 2026

Copy link
Copy Markdown
Contributor

Contribution Type

  • Schema (/schemas)

What does this do?

Fixes a hidden cross-schema dependency in schemas/enhanced-thoughts/schema.sql. The upsert_thought RPC defined in that file writes to status and status_updated_at, but those columns are only added by schemas/workflow-status/migration.sql. docs/01-getting-started.md only instructs users to apply enhanced-thoughts, so following the getting-started path produces a broken RPC and capture_thought fails with:

column "status" of relation "thoughts" does not exist

This PR adds idempotent ADD COLUMN IF NOT EXISTS for status / status_updated_at (and the matching partial index) directly in enhanced-thoughts/schema.sql, so the RPC's dependencies live in the same file. Both schemas use IF NOT EXISTS, so users who already ran workflow-status are unaffected.

Requirements

None — pure SQL change in an existing schema file.

Checklist

  • I've read CONTRIBUTING.md
  • My contribution has a README.md with prerequisites, step-by-step instructions, and expected outcome — N/A, edit to existing schema
  • My metadata.json has all required fields — N/A, no metadata change
  • If my contribution depends on a skill or primitive, I declared it in metadata.json and linked it in the README — N/A
  • I tested this on my own Open Brain instance (ran the equivalent ALTERs against my Supabase; capture_thought now succeeds)
  • No credentials, API keys, or secrets are included

upsert_thought wrote to status/status_updated_at but the columns were
only added by schemas/workflow-status. Anyone applying enhanced-thoughts
alone (as docs/01-getting-started.md instructs) got "column status does
not exist" on capture_thought. Add idempotent ADD COLUMN IF NOT EXISTS
so the RPC's dependencies live in the same file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the schema Contribution: database extension label May 15, 2026
@alanshurafa alanshurafa added review: ready-for-maintainer Community reviewer recommends maintainer review risk: schema Touches database schema, migration, or data model behavior area: schemas Review area: schemas/primitives/data model alan-reviewed Reviewed by Alan Shurafa in Community Reviewer role labels May 20, 2026
@alanshurafa

Copy link
Copy Markdown
Collaborator

Thanks for the contribution. This closes a real gap: enhanced-thoughts ships the upsert_thought RPC that writes status and status_updated_at, but those columns were only declared in schemas/workflow-status. Installing enhanced-thoughts alone would hit a missing-column error.

Checked the column definitions against schemas/workflow-status/migration.sql: the status / status_updated_at types and defaults and the idx_thoughts_status partial index are identical in both files, so applying either or both in any order leaves the same result. The inline comment documenting the dual definition is accurate. Recommend maintainer review.

— Alan (community reviewer; non-binding)

@justfinethanku justfinethanku left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review complete. This is the smallest safe fix for the missing status/status_updated_at dependency in enhanced-thoughts, and Alan already verified the definitions match workflow-status.

@justfinethanku
justfinethanku merged commit 14c39d2 into NateBJones-Projects:main Jun 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alan-reviewed Reviewed by Alan Shurafa in Community Reviewer role area: schemas Review area: schemas/primitives/data model review: ready-for-maintainer Community reviewer recommends maintainer review risk: schema Touches database schema, migration, or data model behavior schema Contribution: database extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants