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 6.1 change_column setting datetime precision #48969

Merged
merged 1 commit into from Aug 22, 2023

Conversation

skipkayhil
Copy link
Member

Motivation / Background

Fix #48965

This is already the case for add_column and create_table, but change_column was missed

Additional Information

This needs to be backported to 7.0, but the test change won't backport cleanly because the Migrator signature in the test changed. I'll make a PR for 7-0-stable as well if that would be easier

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

This is already the case for add_column and create_table, but
change_column was missed
@yahonda
Copy link
Member

yahonda commented Aug 22, 2023

activerecord/CHANGELOG.md conflict needs resolved.

@skipkayhil skipkayhil force-pushed the hm-fix-change-column-precision branch from 77eab53 to c2f838e Compare August 22, 2023 02:12
@yahonda yahonda merged commit e98a6bd into rails:main Aug 22, 2023
9 checks passed
@yahonda
Copy link
Member

yahonda commented Aug 22, 2023

Would you make a back port pull request for the 7-0-stable branch?

I'll make a PR for 7-0-stable as well if that would be easier

skipkayhil added a commit to skipkayhil/rails that referenced this pull request Aug 22, 2023
While working on rails#48969, I found that some of the Compatibility test
cases were not working correctly. The tests removed in this commit were
never running the `change_table` migration and so were not actually
testing that `change_table` works correctly. The issue is that the two
migrations created in these tests both have `nil` versions, and so the
Migrator only runs the first one.

This commit refactors the tests so that its easier to test the behavior
of each Migration class version (and I think the rest of the tests
should be updated to use this strategy as well). Additionally, since the
tests are fixed it exposed that `t.change` in a `change_table` is not
behaving as expected so that is fixed as well.
@skipkayhil skipkayhil deleted the hm-fix-change-column-precision branch August 22, 2023 20:34
@yahonda
Copy link
Member

yahonda commented Aug 23, 2023

Backported to the 7-0-stable branch via #49006

skipkayhil added a commit to skipkayhil/rails that referenced this pull request Aug 23, 2023
While working on rails#48969, I found that some of the Compatibility test
cases were not working correctly. The tests removed in this commit were
never running the `change_table` migration and so were not actually
testing that `change_table` works correctly. The issue is that the two
migrations created in these tests both have `nil` versions, and so the
Migrator only runs the first one.

This commit refactors the tests so that its easier to test the behavior
of each Migration class version (and I think the rest of the tests
should be updated to use this strategy as well). Additionally, since the
tests are fixed it exposed that `t.change` in a `change_table` is not
behaving as expected so that is fixed as well.

(manually backported to 7-0-stable because it did not apply cleanly)
paulreece pushed a commit to paulreece/rails-paulreece that referenced this pull request Aug 26, 2023
While working on rails#48969, I found that some of the Compatibility test
cases were not working correctly. The tests removed in this commit were
never running the `change_table` migration and so were not actually
testing that `change_table` works correctly. The issue is that the two
migrations created in these tests both have `nil` versions, and so the
Migrator only runs the first one.

This commit refactors the tests so that its easier to test the behavior
of each Migration class version (and I think the rest of the tests
should be updated to use this strategy as well). Additionally, since the
tests are fixed it exposed that `t.change` in a `change_table` is not
behaving as expected so that is fixed as well.
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.

Upgrading to Rails 7.0 changes precision when changing column type to datetime
2 participants