Fix Rails 8.1 compatibility for Column#initialize signature#4
Open
pfeffer wants to merge 1 commit intojanuszm:mainfrom
Open
Fix Rails 8.1 compatibility for Column#initialize signature#4pfeffer wants to merge 1 commit intojanuszm:mainfrom
pfeffer wants to merge 1 commit intojanuszm:mainfrom
Conversation
Rails 8.1 changed the Column#initialize signature to require cast_type as the second argument: Old (8.0): initialize(name, default, sql_type_metadata, null, ...) New (8.1): initialize(name, cast_type, default, sql_type_metadata, null, ...) This caused a NoMethodError when loading schemas: undefined method 'mutable?' for nil (NoMethodError) The fix: - Conditionally define RedshiftColumn#initialize based on Rails version - Pass cast_type through from columns() -> new_column() -> RedshiftColumn.new() - Maintains backwards compatibility with Rails 8.0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Salzanoo
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @januszm! I ran into this issue when upgrading to Rails 8.1.2 - could you please take a look?
Summary
Rails 8.1 changed
Column#initializeto requirecast_typeas the second argument, breaking schemaloading.
Error:
Stack trace:
Root cause
The adapter passes default where Rails 8.1 expects cast_type, so cast_type.mutable? is called on nil.
Fix
Tested