Add paginator support from convex-helpers for component migrations#27
Conversation
|
Warning Review limit reached
More reviews will be available in 57 minutes and 31 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository: get-convex/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR extends the Convex migrations library to support running migrations within Convex components using the convex-helpers paginator. The Sequence Diagram(s)sequenceDiagram
participant CLI
participant MigrationsClient
participant isNewFormatCursor
participant Paginator
participant LegacyDB
CLI->>MigrationsClient: start migration (cursor)
MigrationsClient->>isNewFormatCursor: isNewFormatCursor(cursor)
alt new-format
MigrationsClient->>Paginator: paginator(schema).query(table, pageCursor)
Paginator->>MigrationsClient: page results & next cursor
else old-format
MigrationsClient->>LegacyDB: ctx.db.query(table, index, ...)
LegacyDB->>MigrationsClient: query results & opaque cursor
end
MigrationsClient->>CLI: logStatusAndInstructions(componentPath, status, args)
Possibly Related PRs
Suggested Reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
commit: |
f514088 to
6035d49
Compare
35d8dc0 to
d290baa
Compare
73988f0 to
90a7812
Compare
90a7812 to
80b30d6
Compare
- Add convex-helpers as peer dependency for improved pagination - Add optional `schema` parameter to Migrations constructor - Use paginator from convex-helpers when schema is provided - Detect cursor format for backwards compatibility with old migrations - Add isNewFormatCursor() helper with tests - Add SchemaForDataModel type helper - Create local component example demonstrating component migrations - Update README with component migration documentation - Add AGENTS.md with development tips Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
80b30d6 to
f0968bf
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
101-108:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd missing punctuation for readability.
Line 103 is missing a period after the
customRangelink and before "As always". The current text runs two sentences together.📝 Proposed fix
-The `schema` provides type safety for migration definitions and support -for pagination over custom indexes with -[`customRange`](`#migrating-a-subset-of-a-table-using-an-index`) -As always, database operations in migrations will abide +The `schema` provides type safety for migration definitions and support +for pagination over custom indexes with +[`customRange`](`#migrating-a-subset-of-a-table-using-an-index`). +As always, database operations in migrations will abide🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 101 - 108, The sentence after the `customRange` link runs into the next sentence — add a period after the `customRange` link (i.e., end the sentence "pagination over custom indexes with [`customRange`](`#migrating-a-subset-of-a-table-using-an-index`)." ) so that "As always, database operations..." begins a new sentence; also ensure surrounding sentences referencing `schema` and `internalMutation` remain unchanged except for this punctuation fix.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 3: The changelog heading "0.3.5 alpha" is inconsistent with the package
version "0.3.5-alpha.1"; update the heading in CHANGELOG.md (the line containing
"## 0.3.5 alpha") to match the package version format (e.g., "## 0.3.5-alpha.1"
or at least "## 0.3.5-alpha") so release tracking and automation use the exact
version string.
---
Outside diff comments:
In `@README.md`:
- Around line 101-108: The sentence after the `customRange` link runs into the
next sentence — add a period after the `customRange` link (i.e., end the
sentence "pagination over custom indexes with
[`customRange`](`#migrating-a-subset-of-a-table-using-an-index`)." ) so that "As
always, database operations..." begins a new sentence; also ensure surrounding
sentences referencing `schema` and `internalMutation` remain unchanged except
for this punctuation fix.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: get-convex/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5d58283a-5f99-4bd9-a0d0-f970e2a207bd
⛔ Files ignored due to path filters (6)
example/convex/_generated/api.d.tsis excluded by!**/_generated/**example/convex/localComponent/_generated/api.tsis excluded by!**/_generated/**example/convex/localComponent/_generated/component.tsis excluded by!**/_generated/**example/convex/localComponent/_generated/dataModel.tsis excluded by!**/_generated/**example/convex/localComponent/_generated/server.tsis excluded by!**/_generated/**package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (12)
CHANGELOG.mdREADME.mdexample/convex/convex.config.tsexample/convex/example.tsexample/convex/localComponent/convex.config.tsexample/convex/localComponent/example.tsexample/convex/localComponent/schema.tsexample/convex/tsconfig.jsonpackage.jsonsrc/client/index.test.tssrc/client/index.tssrc/client/log.ts
reeceyang
left a comment
There was a problem hiding this comment.
I wonder if we can add a test to example/ that tests that migrations in a component work?
|
there's code in |

Add convex-helpers pagination support
schemaparameter to Migrations constructor enabling customRange and component supportexample/convex/localComponent/demonstrating migrations within a Convex component