Default engine ENGINE=InnoDB is no longer dumped to make schema more agnostic#39365
Merged
kamipo merged 2 commits intorails:masterfrom May 24, 2020
Merged
Default engine ENGINE=InnoDB is no longer dumped to make schema more agnostic#39365kamipo merged 2 commits intorails:masterfrom
ENGINE=InnoDB is no longer dumped to make schema more agnostic#39365kamipo merged 2 commits intorails:masterfrom
Conversation
…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.
Otherwise we cannot handle the same name options for both column and table (e.g. `:comment`, `:charset`, `:collation`).
yahonda
added a commit
to rsim/oracle-enhanced
that referenced
this pull request
May 25, 2020
yahonda
added a commit
to yahonda/oracle-enhanced
that referenced
this pull request
Sep 10, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019 because rails/rails#39365 does not intend to dump the default primary key configuration. Related to rails/rails#39365 Follow up rsim#2019
yahonda
added a commit
to yahonda/oracle-enhanced
that referenced
this pull request
Sep 10, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019 because rails/rails#39365 does not intend to dump the default primary key configuration. Related to rails/rails#39365 Follow up rsim#2019
yahonda
added a commit
to yahonda/oracle-enhanced
that referenced
this pull request
Sep 11, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019 because rails/rails#39365 does not intend to dump the default primary key configuration. To avoid hash creation every time, it has been frozen and saved as a constant. Related to rails/rails#39365 Follow up rsim#2019 Refer http://code.jeremyevans.net/presentations/rubykaigi2019/index.html#58
yahonda
added a commit
to yahonda/oracle-enhanced
that referenced
this pull request
Sep 11, 2020
This pull request restores Schema Dumper behavior changed by rsim#2019 because rails/rails#39365 does not intend to dump the default primary key configuration. To avoid hash creation every time, it has been frozen and saved as a constant. Related to rails/rails#39365 Follow up rsim#2019 Refer http://code.jeremyevans.net/presentations/rubykaigi2019/index.html#58
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 27, 2020
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 28, 2020
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 28, 2020
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Dec 28, 2020
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 1, 2021
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 2, 2021
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 2, 2021
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 2, 2021
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 2, 2021
table options are parsed charset/collation in 6.1.0. related: rails/rails#39365 ``` // before // < 6.1.0 create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end // after // >= 6.1.0 create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` If `dump_without_table_options` is disabled, ridgepole doesn't dump charset/collation.
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 2, 2021
In 6.1, table options are parsed to charset/collation. rails/rails#39365 The following cases should be same result. ``` create_table "items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci" do |t| end create_table "items", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| end ``` To solve this I handled that if new-style `charset/collation` given, it converts to old-style `options`. By doing so, I solved the problem by a little changes. https://github.com/rails/rails/pull/39365/files#diff-868f1dccfcbed26a288bf9f3fd8a39c863a4413ab0075e12b6805d9798f556d1R427
alpaca-tc
added a commit
to alpaca-tc/ridgepole
that referenced
this pull request
Jan 2, 2021
rails/rails#39365 introduced new-style id options like the followings. ``` // < 6.1 old-style create_table(:items, id: :bigint, unsigned: true) {} // >= 6.1 new-style create_table(:items, id: { type: :bigint, unsigned: true }) {} ``` To compare those styles to get diff, I handled that I normalizes id options from those styles.
4 tasks
This was referenced Feb 5, 2021
y-yagi
added a commit
to y-yagi/ridgepole
that referenced
this pull request
Aug 24, 2025
`ridgepole` doesn't know indexes that created by automatically. So checking to avoid those. https://github.com/ridgepole/ridgepole/blob/4a18cef152027d1d02a6f7bb004c9c32d09bb581/lib/ridgepole/dsl_parser.rb#L33-L46 This check depends on `ENGINE=InnoDB` option. But, since Rails 6.1, Rails doesn't output it by default. rails/rails#39365 So the current check doesn't work as expected. This PR fixed to check foreign key when table options is nil or InnoDB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
5 years ago, I made dumping full table options at #17569, especially to
dump
ENGINE=InnoDB ROW_FORMAT=DYNAMICto use utf8mb4 with large keyprefix.
In that time, omitting the default engine
ENGINE=InnoDBwas not usefulsince
ROW_FORMAT=DYNAMICalways remains as long as using utf8mb4 withlarge 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:
After:
To entirely omit
:optionsoption to make schema agnostic, I've added:charsetand:collationtable options to excludeCHARSETandCOLLATEfrom:options.Fixes #26209.
Closes #29472.
See also #33608, #33853, and #34742.