aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2013-03-17 20:29:58 +0100
committerXavier Noria <fxn@hashref.com>2013-03-17 20:29:58 +0100
commit8744632fb5649cf26cdcd1518a3554ece95a401b (patch)
treea258632b7fa143ca105c08f2d5d71c04fb0f460d /activerecord/lib/active_record/connection_adapters
parentb365354e593da172c55770aed22c8211dbc18b08 (diff)
downloadrails-8744632fb5649cf26cdcd1518a3554ece95a401b.tar.gz
rails-8744632fb5649cf26cdcd1518a3554ece95a401b.tar.bz2
rails-8744632fb5649cf26cdcd1518a3554ece95a401b.zip
sets limit 191 for schema_migrations#version in mysql2 if the encoding is "utf8mb4"
Please, see rationale in the included CHANGELOG patch.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
index 20a5ca2baa..25b8aef617 100644
--- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb
@@ -38,6 +38,15 @@ module ActiveRecord
configure_connection
end
+ MAX_INDEX_LENGTH_FOR_UTF8MB4 = 191
+ def initialize_schema_migrations_table
+ if @config[:encoding] == 'utf8mb4'
+ ActiveRecord::SchemaMigration.create_table(MAX_INDEX_LENGTH_FOR_UTF8MB4)
+ else
+ ActiveRecord::SchemaMigration.create_table
+ end
+ end
+
def supports_explain?
true
end