-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add mysql2 support #18
Conversation
94eda5f
to
6096ad7
Compare
|
||
def initialize(klass, current_adapter_name) | ||
@klass = klass | ||
@current_adapter_name = current_adapter_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't this to be a part of the adapter state; we only use it in the apply?
method, so let's pass current adapter as an argument to #apply?
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
got it!
done!
@klass = klass | ||
@current_adapter_name = current_adapter_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Thanks! |
What is the purpose of this pull request?
Added mysql2 support
Is there anything you'd like reviewers to focus on?
Added a new Mysql Adapter
Mysql doesn't support
ON CONFLICT
(but hasON DUPLICATE KEY UPDATE
) and doesn't haveRETURNING ID
So, I used
ActiveRecord::Base.connection.update(sql)
for getting amount of updated rowsAlso, Mysql doesn't understand
EXCLUDED
, so we need to use some methodwrap_column_name
, which will be defined in every adapter. Because, Mysql understandsVALUES(here_column_names)
, but Postgresql understandsEXCLUDED.here_column_name
Checklist