-
Notifications
You must be signed in to change notification settings - Fork 123
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
Doesn't work with add_column/change_column (Rails 4.2.0, mysql2) #56
Comments
Clarification, I've just tested this out on a fresh project. |
This appears to be caused by Rails occasionally not loading the connection adapter before I recommend something like the following:
In this case, the require will throw LoadError if the appropriate gem (mysql2, sqlite3, postgresql) is not also required (typically via |
I have a similar problem but in context of The application is here: https://github.com/currentuser/currentuser-example-blog-rails The problem arise when trying to create a new I used the following workaround to make the application work: # config/application.rb
# Require mysql2_adapter just after rails is loaded to fix
# https://github.com/jashmenn/activeuuid/issues/56
require 'rails/all'
require 'active_record/connection_adapters/mysql2_adapter' You can see the workaround here. |
@tony-currentuser Thanks for that solution. After upgrading from Rails 4.1 to 4.2, I ran into errors saying
I traced the cause to The solution of requiring the |
@tony-currentuser @Confusion Would you try using PR #85 instead? It does patch applications immediately after connections are established, so the load order won't be the problem. |
The add_column call doesn't work starting with Rails 4.2.0.
I am using the mysql2 adapter -- I've not test the issue with other adapters, and using the master branch after the merge of pull request #52 (4.2 support).
The resulting MySQL expression for
add_column :table_name, :column_name, :uuid
is:Similarily, for a change_column
This naturally results in a
Mysql2::Error: You have an error in your SQL syntax near 'uuid'
.I went hunting through ActiveRecord for the appropriate change, but couldn't find the right place, apologies.
The text was updated successfully, but these errors were encountered: