-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sets limit 191 for schema_migrations#version in mysql2 if the encodin…
…g is "utf8mb4" Please, see rationale in the included CHANGELOG patch.
- Loading branch information
Showing
4 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
26 changes: 26 additions & 0 deletions
26
activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require "cases/helper" | ||
|
||
module ActiveRecord | ||
module ConnectionAdapters | ||
class Mysql2Adapter | ||
class SchemaMigrationsTest < ActiveRecord::TestCase | ||
def test_initializes_schema_migrations_for_encoding_utf8mb4 | ||
conn = ActiveRecord::Base.connection | ||
|
||
smtn = ActiveRecord::Migrator.schema_migrations_table_name | ||
conn.drop_table(smtn) if conn.table_exists?(smtn) | ||
|
||
config = conn.instance_variable_get(:@config) | ||
original_encoding = config[:encoding] | ||
|
||
config[:encoding] = 'utf8mb4' | ||
conn.initialize_schema_migrations_table | ||
|
||
assert conn.column_exists?(smtn, :version, :string, limit: Mysql2Adapter::MAX_INDEX_LENGTH_FOR_UTF8MB4) | ||
ensure | ||
config[:encoding] = original_encoding | ||
end | ||
end | ||
end | ||
end | ||
end |