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

Implement v1 #32

Open
wants to merge 71 commits into
base: main
Choose a base branch
from
Open

Implement v1 #32

wants to merge 71 commits into from

Conversation

mirakui
Copy link
Collaborator

@mirakui mirakui commented Oct 13, 2024

  • Added support for ActiveRecord 7.1.
  • Redesigned the proxy chain to accommodate internal structure changes in ActiveRecord 7.1.
  • Introduced integration tests using real databases, allowing for more robust testing of functionality with MySQL, PostgreSQL, SQLite, and SQLServer.

@nekketsuuu nekketsuuu requested a review from a team October 13, 2024 09:03
Copy link
Contributor

@nekketsuuu nekketsuuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for writing these changes!

@@ -2,8 +2,8 @@ module Arproxy
class Base
attr_accessor :proxy_chain, :next_proxy

def execute(sql, name=nil, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q. This removal of kwargs may break some proxies which use keyword arguments.

Have you assumed any proxies, which inherits Arprxy::Base, should not accept keyword arguments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nekketsuuu Good question.
Indeed, in the current Arproxy, Arproxy::Base#execute actually replaced the call to ConnectionAdapter’s #execute, so kwargs was necessary as an argument.
However, in Arproxy v1, a new class named Arproxy::ConnectionAdapterPatch takes on this role. Arproxy::Base#execute is called with two arguments of (sql, name) from the patch, so kwargs is no longer needed in this context.

https://github.com/cookpad/arproxy/pull/32/files#diff-b0f45f0d5c3f0e5178dce37a7f81a3b41699ebec5c4d0a2a3cff7d5a53b7dbcaR72

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this won't break ConnectionAdapter's execute, but I mean that this may break the behavior of execute of the existing proxies (classes that inherit Arproxy::Base). If these proxies use the given keyword arguments, all of them will be changed to nil in v1. I heard that you'd like to maintain backward compatibility for proxies (#30 ), so I wonder if this is your intention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still struggling with this change in specification, but in order to keep up with ActiveRecord version upgrades, I'd like to release it with this specification first.
I've also written about this non-compatible change in the README.

https://github.com/cookpad/arproxy/tree/v1?tab=readme-ov-file#upgrading-guide-from-v0x-to-v1

docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
.github/workflows/integration_tests.yml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
spec/arproxy_spec.rb Outdated Show resolved Hide resolved
@nekketsuuu
Copy link
Contributor

LGTM for the main application code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Developing arproxy v1: integration tests, redesign aiming to fully support for AR7.1+
2 participants