-
Notifications
You must be signed in to change notification settings - Fork 899
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
Unknown collation: 'utf8mb4_col' #741
Comments
I was able to get the migrations to complete by just commenting out the options completely. That seems like the nuclear option...hopefully something else can be done. :) |
Thanks for the issue report, Rob. Yeah, it seems like collations are kind of a disaster in MySQL. They're a big source of pain for developers, anyway. I prefer postgres' decision to have a unified collation for the entire database.
Are you using an old version of MySQL Server? I think utf8mb4 was added in MySQL 5.5.3. (https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html) |
Hi @jaredbeck The AWS RDS instance is at 5.6.22. It doesn't seem to have a problem with the encoding being utf8mb4, but doesn't like that particular collation. When I switched to utf8mb4_unicode_ci it was okay (other than the following problem about index key length). |
Sounds like we should change the migration template to
767 bytes divided by a worst-case scenario of 4 bytes per character does give you 191 characters.
I don't think the error refers to the length of the index name, I think it refers to the length of the data. How is References: |
The collation probably needs to be |
@cannikin What does |
@jaredbeck The migration that was created by the generator specifies the column as:
|
@carsonreinke Here's the output:
|
But, should paper_trail really be specifying an encoding and collation in the migration? If I've got UTF8 as my encoding maybe I'll miss out on higher order characters, but isn't that my own problem? It seems like hardcoding it into the generated migration is just asking for trouble. I don't think I've ever seen a gem that outputs a migration with hardcoded encoding and collations like this. Would it be enough to simply return a warning message in the output of the generator, or a comment in the generated migration explaining the pitfalls of not having utf8mb4? |
I think we should try to provide full unicode support out of the box if possible. If we do not specify an encoding, we'll get |
Ahh, so those settings only apply to this one table, that makes sense. |
Thanks Carson, I'll try |
Rob, I've reproduced the "Unknown collation: 'utf8mb4_col'" error in our test suite, just FYI: https://travis-ci.org/airblade/paper_trail/jobs/119905232 |
Yup that's the one! Now if you change that collation lets see if you get the same key length error... |
Should fix the "Unknown collation: 'utf8mb4_col'" error from #741
Should fix the "Unknown collation: 'utf8mb4_col'" error from #741
I believe you can just leave out the |
Thanks Carson, but unless you see a problem with specifying |
No dice: https://travis-ci.org/airblade/paper_trail/jobs/119910848 You can see in this build that |
Closed by 0435936 which sets the collation to
Rob, if you are able to provide steps to reproduce the "Specified key was too long" using 0435936 or later please open a new issue, thanks! |
Setting up a Rails 5.0.0.beta3 app with paper_trail pointing to master. I'm deploying to an AWS RDS MySQL instance. Deploying fails when trying to migrate the DB with the following error:
I was able to get the table created by changing the collation to "utf8mb4_unicode_ci" (recommened in the blog post that's linked to from the paper_trail-generated migration file: https://mathiasbynens.be/notes/mysql-utf8mb4)
However, once the table was created I then got another error:
This is a lot less than the 191 characters you should be able to use for an index in InnoDB with utf8mb4 columns. Even when I manually shortened the name down to "type_item_id" it still complained about it being too long.
This database was originally created with utf8/utf8_general_ci and then modified to utf8mb4. Maybe that has something to do with it? I can do further testing (drop DB and re-create with different encoding/collation) if needed, just let me know!
The text was updated successfully, but these errors were encountered: