feat: provision + export documents table with generated SQL, SDK, and CLI#35
Merged
pyramation merged 2 commits intodevin/1777497144-add-documents-tablefrom Apr 30, 2026
Conversation
… CLI - Add 'DataId' node to all schema files (required for PK constraint creation) - Run provision: all 11 schemas (including Documents) applied successfully - Run export:pgpm: SQL migrations generated in packages/agentic-db/ - Run generate:all: GraphQL schema, ORM SDK, and CLI regenerated - Documents table includes SearchUnified (embedding + BM25 + chunks) - Junction tables: company_documents, project_documents
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
SearchUnified already creates a BM25 index on embedding_text (which includes content via source_fields). The explicit content BM25 index caused duplicate filter/score fields in the GraphQL API and double-counted content relevance in the composite searchScore. Removed from: - documents.ts: content BM25 index - crm.ts: notes content BM25 index Re-provisioned and regenerated all output.
d190546
into
devin/1777497144-add-documents-table
2 checks passed
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes the provision → export → codegen pipeline for the documents table and all existing schemas. This PR builds on #34 (blueprint definitions) and adds:
DataIdnode restored — all schema files now include'DataId'alongside'DataTimestamps'in theirnodesarrays. RemovingORG_NODESpreviously droppedDataId, which meant tables had no primary key constraint registered in metaschema. This caused chunk table FK generation to produce invalid SQL (REFERENCES parent_table ()instead ofREFERENCES parent_table (id)).Removed duplicate BM25 indexes —
SearchUnifiedalready creates a BM25 index onembedding_text(which includescontentviasource_fields). The explicitcontentBM25 index ondocumentsandnoteswas redundant and caused:bm25Content+bm25EmbeddingText)searchScoreProvisioned all schemas — 11 blueprints (CRM, Agent, Runtime, Projects, Life OS, Email & Calendar, Staging, Autonomy, Documents, Cross-Relations, Spatial Relations) successfully applied to a live database.
Generated SQL migrations (
packages/agentic-db/,packages/agentic-db-services/) — deterministic pgpm export from the provisioned database.Regenerated SDK + CLI — GraphQL schema (1398 types), ORM client (95 tables including
Document,DocumentsChunk,CompanyDocument,ProjectDocument), and CLI commands.New tables added:
documents— with SearchUnified (embedding + BM25 + chunks), repo/path/commit trackingdocuments_chunks— chunked embeddings for RAG (auto-generated by SearchUnifiedchunks: {})company_documents— M2M junction tableproject_documents— M2M junction tableReview & Testing Checklist for Human
documentstable columns match expectations:title,content,metadata(jsonb),repo_name,file_path,commit_hash,tags(citext[])DataIdis present in all schema files'nodesarraysembedding_text, not on rawcontent)pgpm docker start --recreate→ deploy → provision) to verify migrations apply cleanlyDocument,DocumentsChunk,CompanyDocument,ProjectDocumentmodels with expected fieldsNotes
packages/agentic-db/changed becauseDataIdnow creates theidcolumn explicitly (previously it was implicit), which shifts the deterministic ID sequence for all tables.packages/agentic-db-services/had some tables removed (apis,api_schemas,domains) — this appears to be a cleanup from the latest constructive-db platform.</pr_template>
Link to Devin session: https://app.devin.ai/sessions/2a4faca18f1a4b4aaf3d8e1162f67e0d
Requested by: @pyramation