-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 charset and collation options support for MySQL string and text columns. #17574
Conversation
919d69d
to
2050cde
Compare
|
||
def initialize(name, default, cast_type, sql_type = nil, null = true, collation = nil, strict = false, extra = "") | ||
@strict = strict | ||
@collation = collation | ||
@charset = collation.sub(/_.*\z/, '') unless collation.nil? |
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.
Why are we setting a default charset based on the collation?
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.
Although I thought charset necessary for specify collation, was not that necessary.
👍 to the concept. This is a great way to reduce the size of large indexes on ascii columns. |
35778da
to
1070ef1
Compare
1070ef1
to
b038a23
Compare
813d1a2
to
2b2ff83
Compare
f5b2f69
to
a8fc097
Compare
ddc0111
to
23cc2f6
Compare
1c1a187
to
f15532a
Compare
f15532a
to
416754e
Compare
731f1a1
to
47ac3ef
Compare
…text columns Example: create_table :foos do |t| t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin' t.text :text_ascii, charset: 'ascii' end
47ac3ef
to
0aa83f3
Compare
Add charset and collation options support for MySQL string and text columns.
MySQL is possible to specify charset and collation in each column.
This is useful to for a case-sensitive search or specify charset
ascii
to secret_token column.Index size of string column depends on maxlen of that charset. In the case of strict_mode, it can be in error INSERT of characters that are not included in that charset.