Repository navigation
Support default expression and expression indexes for MySQL - #34307
Conversation
MySQL 8.0.13 and higher supports functional key parts that index expression values rather than column or column prefix values. https://dev.mysql.com/doc/refman/8.0/en/create-index.html
MySQL 8.0.13 and higher supports default value to be a function or expression. https://dev.mysql.com/doc/refman/8.0/en/create-table.html
1ac65ef to
a2ad8f4
Compare
| lengths = options.delete(:lengths) | ||
|
|
||
| columns = index[-2].map { |name| | ||
| [ name.to_sym, expressions[name] || +quote_column_name(name) ] |
There was a problem hiding this comment.
Why would we want to dup quote_column_name(name) here?
There was a problem hiding this comment.
This is because the quoted columns would be mutated by add_index_length and add_index_sort_order:
There was a problem hiding this comment.
Ah I see, I thought quote_column_name would return something that was already duped somehow... because it is the case of
... but I didn't realise the method may always return the same object like ...
... got it :)
I'm just realising that there's no way (AFAIK) to know whether a method returns an object that is referenced elsewhere or not, which is kind of sad, because we may be duplicating strings for no reason (if a method returns a new object or an existing object), maybe we should do something about that one day.
There was a problem hiding this comment.
Nevermind, I misread this whole thing 👍
Support default expression and expression indexes for MySQL rails/rails#34307
MySQL 8.0.13 is released a few days ago.
https://mysqlserverteam.com/the-mysql-8-0-13-maintenance-release-is-generally-available/
Now we can supports default expression and expression indexes for mysql2 adapter.