Correctly dump :options on create_table for MySQL#17569
Correctly dump :options on create_table for MySQL#17569rafaelfranca merged 1 commit intorails:masterfrom
:options on create_table for MySQL#17569Conversation
There was a problem hiding this comment.
Not sure these are necessary. If collation is omitted, MySQL will use its default for that charset.
|
👍 to the idea. It's important to support Barracuda formats. |
bf876a8 to
f44759e
Compare
9a69d48 to
7f1606d
Compare
7f1606d to
c0f168f
Compare
|
@matthewd any concern about this one? It will update all the schema tables to explicitly set the |
|
👍; avoiding a bulk schema change does seem slightly desirable, but not important. And explicitness has its own value here, too. |
c0f168f to
454578b
Compare
|
👍 I have currently to monkey patch activerecord to correctly create table from the schema and with the rights options (We're verifying that we able to store utf8bm4 character like 𝌆 for example. |
454578b to
964ff7e
Compare
:options on create_table for MySQL
|
@rafaelfranca Could you merge the changes? |
Correctly dump `:options` on `create_table` for MySQL
|
👍 |
I was added a table options after `force: :cascade` in rails#17569 for not touching existing tests (reducing diff). But `force: :cascade` is not an important information. So I prefer to place a table options before `force: :cascade`.
I was added a table options after `force: :cascade` in rails#17569 for not touching existing tests (reducing diff). But `force: :cascade` is not an important information. So I prefer to place a table options before `force: :cascade`.
…e agnostic 5 years ago, I made dumping full table options at rails#17569, especially to dump `ENGINE=InnoDB ROW_FORMAT=DYNAMIC` to use utf8mb4 with large key prefix. In that time, omitting the default engine `ENGINE=InnoDB` was not useful since `ROW_FORMAT=DYNAMIC` always remains as long as using utf8mb4 with large key prefix. But now, MySQL 5.7.9 has finally changed the default row format to DYNAMIC, utf8mb4 with large key prefix can be used without dumping the default engine and the row format explicitly. So now is a good time to make the default engine is omitted. Before: ```ruby create_table "accounts", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t| end ``` After: ```ruby create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| end ``` To entirely omit `:options` option to make schema agnostic, I've added `:charset` and `:collation` table options to exclude `CHARSET` and `COLLATE` from `:options`. Fixes rails#26209. Closes rails#29472. See also rails#33608, rails#33853, and rails#34742.
Related with #12172.
Is often used to specify table_options in MySQL.
(For example,
"ENGINE=MyISAM"for full-text search,"ENGINE=InnoDB ROW_FORMAT=DYNAMIC"or"ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8"for use InnoDB of Barracuda File Format.)SchemaDumper should support a dump of table_options.