fix(core): refuse to start against a database migrated by a newer version#11
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDatabase migration startup now detects unknown migration IDs newer than the current migration set and aborts with a fatal error. Tests cover rejection of future IDs and acceptance of older unknown IDs. ChangesMigration safety
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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 |
…sion Ported from upstream anomalyco#36429.
4390bcc to
37447c9
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Port of upstream anomalyco/opencode#36429.
Startup now compares the database's applied migration count against the binary's known migrations and fails fast with a clear error when the DB is ahead (i.e. was migrated by a newer version), instead of running against a schema it doesn't understand and corrupting state.
Verified:
bun test test/database-migration.test.ts(17 pass) andbun typecheckfrom packages/core. Applied cleanly.Summary by CodeRabbit
Bug Fixes
Tests