aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/internal_metadata.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/internal_metadata.rb b/activerecord/lib/active_record/internal_metadata.rb
index e5c6e5c885..10fee4dca2 100644
--- a/activerecord/lib/active_record/internal_metadata.rb
+++ b/activerecord/lib/active_record/internal_metadata.rb
@@ -5,6 +5,10 @@ module ActiveRecord
# This class is used to create a table that keeps track of values and keys such
# as which environment migrations were run in.
class InternalMetadata < ActiveRecord::Base # :nodoc:
+ # Keys in mysql are limited to 191 characters, due to this no adapter can
+ # use a longer key
+ KEY_LIMIT = 191
+
class << self
def primary_key
"key"
@@ -34,10 +38,11 @@ module ActiveRecord
def create_table
unless table_exists?
connection.create_table(table_name, id: false) do |t|
- t.column :key, :string
+ t.column :key, :string, null: false, limit: KEY_LIMIT
t.column :value, :string
- t.timestamps
t.index :key, unique: true, name: index_name
+
+ t.timestamps
end
end
end