feat(db): boot older builds on a newer schema when migrations are backward-compatible#1069
feat(db): boot older builds on a newer schema when migrations are backward-compatible#1069IbbyLabs wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
7b417b3 to
844eca5
Compare
…kward-compatible Migrations set backwardCompatible; the runner records it per row. An older build booting on a newer database starts only if every newer migration is marked compatible, else fails as before.
844eca5 to
bf6ab23
Compare
|
@Viren070 reworked it, migrations now declare if they're backwards compatible and the runner enforces it, breaking ones still block. |
AIOStreams migrations are append-only, so once a database is migrated by a newer build, an older build refuses to start (
Database is at migration N but this build only knows up to M), even when the newer migrations only added things the older code never touches. Rolling back, or trying a newer build and then going back, means manual SQL or wiping the database.A migration can now declare
backwardCompatiblewhen it only adds tables/columns/indexes older code ignores. The runner records that per row in_migrations, and on boot an older build starts against a newer database only if every newer migration is marked compatible. A rename, drop, or retype of an existing table still blocks the boot.So rolling back a bad upgrade, or trying a build without committing to it, just works for additive changes and stays protected against the ones that would actually break. Nothing to configure.