diff options
-rw-r--r-- | activerecord/lib/active_record/internal_metadata.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/schema_migration.rb | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/internal_metadata.rb b/activerecord/lib/active_record/internal_metadata.rb index 2e962f4218..e5c6e5c885 100644 --- a/activerecord/lib/active_record/internal_metadata.rb +++ b/activerecord/lib/active_record/internal_metadata.rb @@ -33,13 +33,12 @@ module ActiveRecord # Creates an internal metadata table with columns +key+ and +value+ def create_table unless table_exists? - connection.create_table(table_name, primary_key: :key, id: false ) do |t| + connection.create_table(table_name, id: false) do |t| t.column :key, :string t.column :value, :string t.timestamps + t.index :key, unique: true, name: index_name end - - connection.add_index table_name, :key, unique: true, name: index_name end end end diff --git a/activerecord/lib/active_record/schema_migration.rb b/activerecord/lib/active_record/schema_migration.rb index 3017ee0bbb..ee4c71f304 100644 --- a/activerecord/lib/active_record/schema_migration.rb +++ b/activerecord/lib/active_record/schema_migration.rb @@ -31,8 +31,8 @@ module ActiveRecord connection.create_table(table_name, id: false) do |t| t.column :version, :string, version_options + t.index :version, unique: true, name: index_name end - connection.add_index table_name, :version, unique: true, name: index_name end end |