Rails 6.1: Coerce schema cache test to handle Time marshal in ruby 2.5 and 2.6 #916
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.
This PR fixes:
Those errors only exists in ruby 2.5 and 2.6 runs
Context
Rails 6.1 adds support for marshal as a schema cache serialization strategy (rails/rails@9a356fc)
Ruby 2.5 and Ruby 2.6 have a bug that prevents them to marshal Time instances before 1900 (see https://bugs.ruby-lang.org/issues/15160). The issue is not present on 2.7. Found the link looking at rails/rails#41075.
sst_datatypes
table has a datetime column with default1753-01-01T00:00:00.123
. The table is created here https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/main/test/schema/datatypes/2012.sql#L27.Possible solutions
That file has been around for a while. I can't tell why
1753-01-01T00:00:00.123
was picked. For example, I can't tell if it's covering some specific scenario.change the default value just for the failing test and rubies.
Time
Haven't thought/investigate this path but felt that would lead to issues.
I choose the second option