aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2016-12-23 15:51:11 +0900
committerAkira Matsuda <ronnie@dio.jp>2016-12-24 23:39:36 +0900
commit5b14129d8d4ad302b4e11df6bd5c7891b75f393c (patch)
treecfcd0a51846f540f40cc314e29a7070b415a9219 /activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
parent6c5bbb4b7d3bdd1b43e512fb6ae764c373c7827b (diff)
downloadrails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.gz
rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.tar.bz2
rails-5b14129d8d4ad302b4e11df6bd5c7891b75f393c.zip
Privatize unneededly protected methods in Active Record
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb36
1 files changed, 17 insertions, 19 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
index 6985d2c1b2..68a88e71ba 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
@@ -649,9 +649,9 @@ module ActiveRecord
!native_database_types[type].nil?
end
- protected
+ private
- def initialize_type_map(m) # :nodoc:
+ def initialize_type_map(m)
super
register_class_with_limit m, %r(char)i, MysqlString
@@ -691,7 +691,7 @@ module ActiveRecord
end
end
- def register_integer_type(mapping, key, options) # :nodoc:
+ def register_integer_type(mapping, key, options)
mapping.register_type(key) do |sql_type|
if /\bunsigned\b/.match?(sql_type)
Type::UnsignedInteger.new(options)
@@ -701,7 +701,7 @@ module ActiveRecord
end
end
- def extract_precision(sql_type)
+ def extract_precision(sql_type) # :doc:
if /time/.match?(sql_type)
super || 0
else
@@ -709,11 +709,11 @@ module ActiveRecord
end
end
- def fetch_type_metadata(sql_type, extra = "")
+ def fetch_type_metadata(sql_type, extra = "") # :doc:
MySQL::TypeMetadata.new(super(sql_type), extra: extra)
end
- def add_index_length(quoted_columns, **options)
+ def add_index_length(quoted_columns, **options) # :doc:
if length = options[:length]
case length
when Hash
@@ -727,7 +727,7 @@ module ActiveRecord
quoted_columns
end
- def add_options_for_index_columns(quoted_columns, **options)
+ def add_options_for_index_columns(quoted_columns, **options) # :doc:
quoted_columns = add_index_length(quoted_columns, options)
super
end
@@ -743,7 +743,7 @@ module ActiveRecord
ER_CANNOT_ADD_FOREIGN = 1215
ER_CANNOT_CREATE_TABLE = 1005
- def translate_exception(exception, message)
+ def translate_exception(exception, message) # :doc:
case error_number(exception)
when ER_DUP_ENTRY
RecordNotUnique.new(message)
@@ -770,13 +770,13 @@ module ActiveRecord
end
end
- def add_column_sql(table_name, column_name, type, options = {})
+ def add_column_sql(table_name, column_name, type, options = {}) # :doc:
td = create_table_definition(table_name)
cd = td.new_column_definition(column_name, type, options)
schema_creation.accept(AddColumnDefinition.new(cd))
end
- def change_column_sql(table_name, column_name, type, options = {})
+ def change_column_sql(table_name, column_name, type, options = {}) # :doc:
column = column_for(table_name, column_name)
unless options_include_default?(options)
@@ -796,7 +796,7 @@ module ActiveRecord
schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
end
- def rename_column_sql(table_name, column_name, new_column_name)
+ def rename_column_sql(table_name, column_name, new_column_name) # :doc:
column = column_for(table_name, column_name)
options = {
default: column.default,
@@ -810,35 +810,33 @@ module ActiveRecord
schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
end
- def remove_column_sql(table_name, column_name, type = nil, options = {})
+ def remove_column_sql(table_name, column_name, type = nil, options = {}) # :doc:
"DROP #{quote_column_name(column_name)}"
end
- def remove_columns_sql(table_name, *column_names)
+ def remove_columns_sql(table_name, *column_names) # :doc:
column_names.map { |column_name| remove_column_sql(table_name, column_name) }
end
- def add_index_sql(table_name, column_name, options = {})
+ def add_index_sql(table_name, column_name, options = {}) # :doc:
index_name, index_type, index_columns, _, index_algorithm, index_using = add_index_options(table_name, column_name, options)
index_algorithm[0, 0] = ", " if index_algorithm.present?
"ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_algorithm}"
end
- def remove_index_sql(table_name, options = {})
+ def remove_index_sql(table_name, options = {}) # :doc:
index_name = index_name_for_remove(table_name, options)
"DROP INDEX #{index_name}"
end
- def add_timestamps_sql(table_name, options = {})
+ def add_timestamps_sql(table_name, options = {}) # :doc:
[add_column_sql(table_name, :created_at, :datetime, options), add_column_sql(table_name, :updated_at, :datetime, options)]
end
- def remove_timestamps_sql(table_name, options = {})
+ def remove_timestamps_sql(table_name, options = {}) # :doc:
[remove_column_sql(table_name, :updated_at), remove_column_sql(table_name, :created_at)]
end
- private
-
# MySQL is too stupid to create a temporary table for use subquery, so we have
# to give it some prompting in the form of a subsubquery. Ugh!
def subquery_for(key, select)