1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Rename active_record_internal_metadatas to ar_internal_metadata"

This reverts commit 407e0ab5e5.
This commit is contained in:
Yasuo Honda 2016-07-01 17:38:52 +00:00
parent 0d8d64e9d0
commit 545583d773
2 changed files with 0 additions and 28 deletions

View file

@ -14,10 +14,6 @@ module ActiveRecord
"#{table_name_prefix}#{ActiveRecord::Base.internal_metadata_table_name}#{table_name_suffix}" "#{table_name_prefix}#{ActiveRecord::Base.internal_metadata_table_name}#{table_name_suffix}"
end end
def original_table_name
"#{table_name_prefix}active_record_internal_metadatas#{table_name_suffix}"
end
def []=(key, value) def []=(key, value)
find_or_initialize_by(key: key).update_attributes!(value: value) find_or_initialize_by(key: key).update_attributes!(value: value)
end end
@ -30,17 +26,8 @@ module ActiveRecord
ActiveSupport::Deprecation.silence { connection.table_exists?(table_name) } ActiveSupport::Deprecation.silence { connection.table_exists?(table_name) }
end end
def original_table_exists?
# This method will be removed in Rails 5.1
# Since it is only necessary when `active_record_internal_metadatas` could exist
ActiveSupport::Deprecation.silence { connection.table_exists?(original_table_name) }
end
# Creates an internal metadata table with columns +key+ and +value+ # Creates an internal metadata table with columns +key+ and +value+
def create_table def create_table
if original_table_exists?
connection.rename_table(original_table_name, table_name)
end
unless table_exists? unless table_exists?
key_options = connection.internal_string_options_for_primary_key key_options = connection.internal_string_options_for_primary_key

View file

@ -445,21 +445,6 @@ class MigrationTest < ActiveRecord::TestCase
ActiveRecord::Migrator.migrations_paths = old_path ActiveRecord::Migrator.migrations_paths = old_path
end end
def test_rename_internal_metadata_table
original_internal_metadata_table_name = ActiveRecord::Base.internal_metadata_table_name
ActiveRecord::Base.internal_metadata_table_name = "active_record_internal_metadatas"
Reminder.reset_table_name
ActiveRecord::Base.internal_metadata_table_name = original_internal_metadata_table_name
Reminder.reset_table_name
assert_equal "ar_internal_metadata", ActiveRecord::InternalMetadata.table_name
ensure
ActiveRecord::Base.internal_metadata_table_name = original_internal_metadata_table_name
Reminder.reset_table_name
end
def test_proper_table_name_on_migration def test_proper_table_name_on_migration
reminder_class = new_isolated_reminder_class reminder_class = new_isolated_reminder_class
migration = ActiveRecord::Migration.new migration = ActiveRecord::Migration.new