fix: use AutoMigrate and add runner_id/created_by_user_id columns to sidekiq table migration#5085
fix: use AutoMigrate and add runner_id/created_by_user_id columns to sidekiq table migration#5085BearTS wants to merge 1 commit into
AutoMigrate and add runner_id/created_by_user_id columns to sidekiq table migration#5085Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Sidekiq table migration now uses ChangesSidekiq migration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
AutoMigrate and add runner_id/created_by_user_id columns to sidekiq table migration
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "fix: migration for sidekiq" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@framework/configstore/migrations.go`:
- Around line 10479-10484: Update the migration’s rollback logic associated with
the Sidekiq table creation to avoid unconditionally dropping an existing table.
Track whether the migration created sidekiq, and only execute the drop when it
did; otherwise preserve the table and its data, or explicitly mark/document the
migration as non-rollbackable.
- Around line 10473-10484: In the migration switch’s default branch, return
immediately after the fallback
`tx.Migrator().AutoMigrate(&tables.TableSidekiqJob{})` succeeds (while
propagating errors), preventing execution from falling through to
`tx.Exec(createTable)` and index creation with an empty statement.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 00a47dc7-6e6a-4ea3-921c-a927ba61fed2
📒 Files selected for processing (1)
framework/configstore/migrations.go
c846c5d to
6e98b85
Compare

Summary
The
migrationAddSidekiqTablefunction previously usedCreateTablefor non-MySQL/PostgreSQL dialects, which would fail if the table already existed. This PR switches toAutoMigratefor the fallback dialect path and adds explicit column addition handling forrunner_idandcreated_by_user_idon existingTableSidekiqJobtables.Changes
tx.Migrator().CreateTable()withtx.Migrator().AutoMigrate()in the default dialect fallback branch so the migration is idempotent and won't hard-fail on pre-existing tables.addColumnIfNotExistscalls forrunner_idandcreated_by_user_idcolumns to ensure existingsidekiq_jobstables receive the new columns without requiring a full table recreation.Type of change
Affected areas
How to test
Run the migration against an environment with a pre-existing
sidekiq_jobstable (missingrunner_idandcreated_by_user_idcolumns) and verify the migration completes without error and the new columns are present.go test ./framework/configstore/...Verify that after migration:
sidekiq_jobstable still exists with all original data intact.runner_idandcreated_by_user_idcolumns are present.Screenshots/Recordings
N/A
Breaking changes
Related issues
N/A
Security considerations
No security implications. This change only affects database schema migration logic.
Checklist
docs/contributing/README.mdand followed the guidelines