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_table setting datetime precision #48974

Merged
merged 1 commit into from Aug 23, 2023

Conversation

skipkayhil
Copy link
Member

Motivation / Background

While working on #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.

Detail

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.

Additional information

This should be backported to 7-0-stable. Because of the change to the migrator signature it will likely not apply cleanly, I'm happy to make a PR to 7-0-stable if that would make it 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.

@rafaelfranca
Copy link
Member

CI is broken. Can you take a look?

@skipkayhil skipkayhil force-pushed the hm-fix-change-table-precision branch 2 times, most recently from 6118921 to cc4725f Compare August 21, 2023 21:17
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 force-pushed the hm-fix-change-table-precision branch from cc4725f to 9b07b2d Compare August 22, 2023 18:02
@yahonda yahonda merged commit 2c5bfbd into rails:main Aug 23, 2023
4 checks passed
@yahonda
Copy link
Member

yahonda commented Aug 23, 2023

I'm happy to make a PR to 7-0-stable if that would make it easier.

Would you make a pull request to backport this change to the 7-0-stable branch?

@skipkayhil skipkayhil deleted the hm-fix-change-table-precision branch August 23, 2023 01:59
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

3 participants