Skip to content

Add CompatibilityBehavior plumbing for per-adapter migration compatibility - #2823

Open
yahonda wants to merge 1 commit into
rsim:masterfrom
yahonda:v4-migration-compatibility-behavior-base
Open

Add CompatibilityBehavior plumbing for per-adapter migration compatibility#2823
yahonda wants to merge 1 commit into
rsim:masterfrom
yahonda:v4-migration-compatibility-behavior-base

Conversation

@yahonda

@yahonda yahonda commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Plumbing for Rails' per-adapter migration compatibility extension point (compatibility_behavior_for / ActiveRecord::Migration::CompatibilityBehavior, rails/rails PR-pending, currently tracked on yahonda/rails branch per-adapter-migration-compatibility-v7). No behavior change — this PR only gives Oracle-specific per-version migration behavior a place to live.

Implementation

  • New OracleEnhanced::CompatibilityBehavior namespace (extend ActiveRecord::Migration::CompatibilityBehavior::Resolver), returned by the adapter's compatibility_behavior_for(migration_class) override. The Resolver maps a migration's declared ActiveRecord::Migration[x.y] version to the lowest defined behavior version covering it: Migration[8.2] and later resolve to V8_2, Migration[8.1] and earlier to V8_1, and an unversioned migration to the framework's no-op base.
  • V8_2 and V8_1 are empty skeletons, so every operation runs exactly as before. The version-specific adjustments land in the two PRs built on this one — either can merge first once this PR lands:

Tests

migration_compatibility_spec.rb pins the version → behavior resolution: Migration[8.2]V8_2; Migration[8.1] and Migration[7.0]V8_1; an unversioned migration → the no-op base.

Depends on

  • Rails framework PR introducing compatibility_behavior_for and Migration::CompatibilityBehavior (currently yahonda/rails branch per-adapter-migration-compatibility-v7). The Gemfile points at that branch until it lands.

@yahonda

yahonda commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

Depends on rails/rails#58162, which adds the compatibility_behavior_for hook this PR builds on.

…ility

Wire the adapter into Rails' per-adapter migration compatibility hook so
version-declared migrations (`ActiveRecord::Migration[x.y]`) can get
Oracle-specific per-version behavior:

* New `OracleEnhanced::CompatibilityBehavior` (`extend Base::Resolver`)
  is returned by the adapter's `compatibility_behavior_for(migration_class)`
  override. The Resolver maps a migration's declared version to the
  lowest defined behavior version covering it: `Migration[8.2]` and later
  resolve to `V8_2`, `Migration[8.1]` and earlier to `V8_1`, and an
  unversioned migration to the framework's no-op base.
* `V8_2` and `V8_1` are empty here — this commit is plumbing only and
  changes no behavior. The identity primary key default (rsim#2816) and the
  implicit-UNIQUE-CONSTRAINT Phase 2 flip (rsim#2817) each fill in their
  version-specific adjustments on top of this commit.
* Gemfile points activerecord at yahonda/rails
  per-adapter-migration-compatibility-v7 for the framework dispatch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@yahonda
yahonda force-pushed the v4-migration-compatibility-behavior-base branch from b15dd6f to 4a60243 Compare August 7, 2026 15:30
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