Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migration compatibility for default precision value on datetime columns (Round 2) #42631

Merged
merged 1 commit into from Jun 29, 2021

Conversation

robertomiranda
Copy link
Contributor

@robertomiranda robertomiranda commented Jun 28, 2021

What

Fix migration compatibility for default precision value on datetime columns

Why

Microseconds precision is the new default and was introduced on #42297, but in #42606 I found a compatibility issue. Another compatibility issue has been raised in #42606 (comment). ActiveRecord::Migration::Compatibility should prevent the introduction of this new behaviour on previous versions to 7.0.

How

  1. I've added test cases from rails 4.2 to 6.1 f365588, showing that t.datime compatibility is broken from 4.2 to 6.0,
  2. I've redefined the column method for Rails on V6_0 class cddfc07 to fix the compatibility on Rails 6.0
  3. Following the same approach on cddfc07, 7d5c443e00 redefines the column method behaviour on the class V5_2 Fixing compatibility on rails version from 4.2 to 5.2

cc @guilleiguaran @zzak @ghiculescu @Tonkpils

@robertomiranda robertomiranda changed the title Fix migration compatibility for default precision value on datetime columns Fix migration compatibility for default precision value on datetime columns (Round 2) Jun 28, 2021
@robertomiranda robertomiranda marked this pull request as ready for review June 28, 2021 20:24
…olumns (Round 2)

add test cases on default precision from 4.2 to 6.1

Fix compatibility on rails 6.0

Fix compatibility from 5.2 to 4.2
@Tonkpils
Copy link
Contributor

👍 I've tested this patch against our CI and it fixes the issue 🙇

@guilleiguaran guilleiguaran merged commit c3a1bfe into rails:main Jun 29, 2021
@zzak
Copy link
Member

zzak commented Jun 29, 2021

Thank you for your effort @robertomiranda 🙇

@robertomiranda robertomiranda deleted the compatibily-fix branch June 29, 2021 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants