-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support Rails 6.1 and 7.0 (DNM -- for reference only) #20
Closed
Commits on Dec 28, 2022
-
Support Rails 5.2, 6.x, and 7.0
Seeing the performance advantages of the Trilogy driver compared with mysql2 has motivated me to make it compatible with older Rails versions. I'm hoping it can become the MySQL driver of choice in the Rails community. After trying several approaches, have ended up with the solution you see in this PR. **ActiveRecord Trilogy Adapter** was originally written with a forward-thinking mind set -- one exclusive to Rails 7.1 and later. The older database adapter framework found in prior versions of Rails differs a fair bit from that found in 7.1, so there are some core differences to bridge in order to have Trilogy become compatible with prior Rails versions. This PR adds backwards compatibility in such a way that it does not interfere with the lean nature of how AR Trilogy has been architected -- it adds that compatibility layer via a series of patches all tucked away in a separate file. Inside that compatibility file, backwards_ar_compatibility.rb, checks are done to identify which newer methods are missing. They are selectively added back in, with the ultimate goal of establishing the broadest compatibility possible. Only those patches which are necessary for any given Rails version get applied, making it minimally invasive. This approach requires no changes to Trilogy itself, so it functions in exactly the same way as it always has done -- as if everything is just ActiveRecord 7.1+. As such newer Rails 7.1 apps are completely unaffected because for them none of that patching needs be applied.
Configuration menu - View commit details
-
Copy full SHA for 481111d - Browse repository at this point
Copy the full SHA 481111dView commit details -
Enable tests to run under Rails < 7.1
You're likely familiar with how to set up and run the tests for this project -- after confirming that inside of `bin/setup` on the last line it shows the same path out to `mysql` as you see when running `which mysql` then to test against edge Rails here are the commands: ``` bin/setup bundle exec rake ``` And once you've done that, which configures the test database appropriately then thankfully it's pretty easy to re-bundle in order to then run the tests under an older version: ``` rm Gemfile.lock RAILS_VERSION="~> 6.1" bundle RAILS_VERSION="~> 6.1" bundle exec rake ```
Configuration menu - View commit details
-
Copy full SHA for 59bec56 - Browse repository at this point
Copy the full SHA 59bec56View commit details
Commits on Dec 31, 2022
-
Configuration menu - View commit details
-
Copy full SHA for ca4fdf9 - Browse repository at this point
Copy the full SHA ca4fdf9View commit details -
Appraisal makes it simple to run the Trilogy tests for an specific version of ActiveRecord: bundle exec appraisal rails-7.0 rake or to run against edge Rails: bundle exec appraisal rails-head rake
Configuration menu - View commit details
-
Copy full SHA for e121ccb - Browse repository at this point
Copy the full SHA e121ccbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 787e6d9 - Browse repository at this point
Copy the full SHA 787e6d9View commit details
Commits on Jan 4, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 8672123 - Browse repository at this point
Copy the full SHA 8672123View commit details
Commits on Jan 6, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 411301d - Browse repository at this point
Copy the full SHA 411301dView commit details -
Fix query_flags timezone test failures under AR 6.1
Set QUERY_FLAGS_LOCAL_TIMEZONE properly which should allow these two to pass: #test_query_flags_for_timezone_can_be_set_to_local #test_query_flags_for_timezone_can_be_set_to_local_and_reset_to_utc
Configuration menu - View commit details
-
Copy full SHA for 9cc4a25 - Browse repository at this point
Copy the full SHA 9cc4a25View commit details
Commits on Jan 13, 2023
-
Configuration menu - View commit details
-
Copy full SHA for be7812e - Browse repository at this point
Copy the full SHA be7812eView commit details -
Configuration menu - View commit details
-
Copy full SHA for bc22c89 - Browse repository at this point
Copy the full SHA bc22c89View commit details
Commits on Jan 14, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 533e425 - Browse repository at this point
Copy the full SHA 533e425View commit details
Commits on Jan 16, 2023
-
Compatibility for updated error classes in Trilogy driver from PR#15
There is a new generic Trilogy::ClientError class established with this PR which is useful to provide full AR 7.0 support: trilogy-libraries/trilogy#15
Configuration menu - View commit details
-
Copy full SHA for 711a689 - Browse repository at this point
Copy the full SHA 711a689View commit details
Commits on Jan 24, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 9f60801 - Browse repository at this point
Copy the full SHA 9f60801View commit details
Commits on Feb 2, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 8674e31 - Browse repository at this point
Copy the full SHA 8674e31View commit details
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.