Skip to content

feat(db): boot older builds on a newer schema when migrations are backward-compatible#1069

Open
IbbyLabs wants to merge 1 commit into
Viren070:devfrom
IbbyLabs:fix/allow-newer-schema
Open

feat(db): boot older builds on a newer schema when migrations are backward-compatible#1069
IbbyLabs wants to merge 1 commit into
Viren070:devfrom
IbbyLabs:fix/allow-newer-schema

Conversation

@IbbyLabs

@IbbyLabs IbbyLabs commented Jul 3, 2026

Copy link
Copy Markdown

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 backwardCompatible when 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.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 860be2a0-aa36-46f9-8e40-844d598ab2e7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@IbbyLabs IbbyLabs changed the title fix(db): allow booting on a newer schema via ALLOW_NEWER_SCHEMA feat(db): boot older builds on a newer schema when migrations are backward-compatible Jul 4, 2026
@IbbyLabs IbbyLabs force-pushed the fix/allow-newer-schema branch from 7b417b3 to 844eca5 Compare July 4, 2026 00:27
…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.
@IbbyLabs IbbyLabs force-pushed the fix/allow-newer-schema branch from 844eca5 to bf6ab23 Compare July 4, 2026 00:36
@IbbyLabs

IbbyLabs commented Jul 4, 2026

Copy link
Copy Markdown
Author

@Viren070 reworked it, migrations now declare if they're backwards compatible and the runner enforces it, breaking ones still block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant