Skip to content

[recipes] Make schema-aware routing SQL idempotent#310

Open
Humestone wants to merge 1 commit into
NateBJones-Projects:mainfrom
Humestone:contrib/humestone/schema-aware-routing-idempotent
Open

[recipes] Make schema-aware routing SQL idempotent#310
Humestone wants to merge 1 commit into
NateBJones-Projects:mainfrom
Humestone:contrib/humestone/schema-aware-routing-idempotent

Conversation

@Humestone
Copy link
Copy Markdown

Summary

  • update the schema-aware-routing README setup SQL so it uses create table if not exists for recipe tables
  • extend an existing canonical thoughts table with domain, status, and source via alter table ... add column if not exists
  • add supporting indexes for the recipe-specific thoughts columns and clarify the SQL is safe after the canonical getting-started setup

Why

The current README tells users to create thoughts from scratch. That fails or conflicts for users who already followed the canonical OB1 getting-started SQL. This keeps the recipe aligned with OB1's shared thoughts table contract while preserving the standalone setup path.

Verification

  • reviewed the README SQL block against docs/01-getting-started.md
  • rg check for non-idempotent table creation in the edited block
  • git diff --check

Notes

This PR only updates the setup SQL embedded in the README on current main; it does not add missing scaffold files or new runtime behavior.

Related to #262.

@github-actions github-actions Bot added the recipe Contribution: step-by-step recipe label May 17, 2026
@alanshurafa alanshurafa added review: needs-author-response Contributor response or clarification needed risk: schema Touches database schema, migration, or data model behavior area: recipes Review area: recipes alan-reviewed Reviewed by Alan Shurafa in Community Reviewer role labels May 20, 2026
@alanshurafa
Copy link
Copy Markdown
Collaborator

Thanks for the contribution. Making the recipe SQL idempotent is the right direction — create table if not exists plus alter ... add column if not exists lets it run cleanly after the canonical OB1 setup.

One thing to resolve before this is ready: the recipe adds status text default 'active' to the shared thoughts table, but schemas/workflow-status already declares status on thoughts as text default null and uses it for kanban-style task/idea state. Since add column if not exists skips when the column is already present, both the default and the meaning of status would depend on which setup ran first. Could you confirm whether this recipe's status is the same concept? If it is, matching default null keeps the two consistent; if it is a distinct routing concept, a different column name would avoid the collision. (domain and source look recipe-specific — no conflict there.)

Minor: the alter ... add column if not exists lines for metadata, created_at, and updated_at duplicate columns the create table block above already declares — worth trimming for clarity.

Recommend author refresh once the status question is settled.

— Alan (community reviewer; non-binding)

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: recipes Review area: recipes recipe Contribution: step-by-step recipe review: needs-author-response Contributor response or clarification needed risk: schema Touches database schema, migration, or data model behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants