diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2014-11-13 04:30:57 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-02-26 07:57:53 +0900 |
commit | 3239b6a98ad7c99b6bd8cd6345c59430e5d38083 (patch) | |
tree | 309228578885d7b14e9f979b1fe12513e38d94ca /activerecord/test | |
parent | 026ce5ddf11c4cda0aae7f33a9266e54117db318 (diff) | |
download | rails-3239b6a98ad7c99b6bd8cd6345c59430e5d38083.tar.gz rails-3239b6a98ad7c99b6bd8cd6345c59430e5d38083.tar.bz2 rails-3239b6a98ad7c99b6bd8cd6345c59430e5d38083.zip |
Add `SchemaMigration.create_table` support any unicode charsets for MySQL.
MySQL unicode support is not only `utf8mb4`.
Then, The index length problem is not only `utf8mb4`.
http://dev.mysql.com/doc/refman/5.6/en/charset-unicode.html
SELECT * FROM information_schema.character_sets WHERE maxlen > 3;
+--------------------+----------------------+------------------+--------+
| CHARACTER_SET_NAME | DEFAULT_COLLATE_NAME | DESCRIPTION | MAXLEN |
+--------------------+----------------------+------------------+--------+
| utf8mb4 | utf8mb4_general_ci | UTF-8 Unicode | 4 |
| utf16 | utf16_general_ci | UTF-16 Unicode | 4 |
| utf16le | utf16le_general_ci | UTF-16LE Unicode | 4 |
| utf32 | utf32_general_ci | UTF-32 Unicode | 4 |
+--------------------+----------------------+------------------+--------+
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb index 271b570eb5..417ccf6d11 100644 --- a/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +++ b/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb @@ -2,7 +2,7 @@ require "cases/helper" module ActiveRecord module ConnectionAdapters - class Mysql2Adapter + class AbstractMysqlAdapter class SchemaMigrationsTest < ActiveRecord::TestCase def test_renaming_index_on_foreign_key connection.add_index "engines", "car_id" @@ -28,7 +28,7 @@ module ActiveRecord connection.initialize_schema_migrations_table - assert connection.column_exists?(smtn, :version, :string, limit: Mysql2Adapter::MAX_INDEX_LENGTH_FOR_UTF8MB4) + assert connection.column_exists?(smtn, :version, :string, limit: AbstractMysqlAdapter::MAX_INDEX_LENGTH_FOR_CHARSETS_OF_4BYTES_MAXLEN) ensure execute("ALTER DATABASE #{database_name} DEFAULT CHARACTER SET #{original_charset} COLLATE #{original_collation}") end |