-
Notifications
You must be signed in to change notification settings - Fork 96
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
MySQL trigger syntax schema #29
Comments
I noticed even when I do:
The quotes are striped out, I we end up with:
|
looks like it's due to how mysql returns the Definer when you call so it should be pretty easy to make hairtrigger handle that correctly that said, it is a little odd that your schema.rb is generating raw |
They were added as model triggers with the rake task, as described in the documentation. Let me know if you would like a code sample. |
Come to think of it I did get this message in the schema.rb as well: " WARNING: generating adapter-specific definition for #{name} due to a mismatch. either there's a bug in hairtrigger or you've messed up your migrations and/or db :-/" |
that might be a symptom of the definer mismatch. so yeah, if you could send a sample of the model triggers you're using, that would help track it down and hopefully we can solve both problems at once |
Here is the migration that was generated:
|
And here is a module included in our active record models:
|
mysql version 5.1.70 |
Which created this in the schema.rb
|
When we added this module to multiple models at the same time we got this:
|
Everything was working great until..
rake db:reset
Was able to hunt the issue down and it turns out this was being generated in the schema.rb file:
The fix is:
The only difference is putting quotes around the username and host. I checked the mysql documentation and found this:
http://dev.mysql.com/doc/refman/5.1/en/create-trigger.html
"The DEFINER clause specifies the MySQL account to be used when checking access privileges at trigger activation time. If a user value is given, it should be a MySQL account specified as 'user_name'@'host_name' (the same format used in the GRANT statement), CURRENT_USER, or CURRENT_USER(). The default DEFINER value is the user who executes the CREATE TRIGGER statement. This is the same as specifying DEFINER = CURRENT_USER explicitly."
The text was updated successfully, but these errors were encountered: