Module: ActiveRecord::Migration::Compatibility::V7_0::LegacyIndexName
Do not use. This module is for internal use only.
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
::ActiveRecord::Migration::Compatibility::V4_2 ,
::ActiveRecord::Migration::Compatibility::V5_0 ,
::ActiveRecord::Migration::Compatibility::V5_1 ,
::ActiveRecord::Migration::Compatibility::V5_2 ,
::ActiveRecord::Migration::Compatibility::V6_0 ,
::ActiveRecord::Migration::Compatibility::V6_1 ,
::ActiveRecord::Migration::Compatibility::V7_0 ,
TableDefinition
| |
Defined in: | activerecord/lib/active_record/migration/compatibility.rb |
Instance Method Summary
Instance Method Details
#expression_column_name?(column_name) ⇒ Boolean
(private)
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 68
def expression_column_name?(column_name) column_name.is_a?(String) && /\W/.match?(column_name) end
#index_name_options(column_names) (private)
[ GitHub ]# File 'activerecord/lib/active_record/migration/compatibility.rb', line 60
def (column_names) if expression_column_name?(column_names) column_names = column_names.scan(/\w+/).join("_") end { column: column_names } end
#legacy_index_name(table_name, options) (private)
[ GitHub ]# File 'activerecord/lib/active_record/migration/compatibility.rb', line 46
def legacy_index_name(table_name, ) if Hash === if [:column] "index_#{table_name}_on_#{Array( [:column]) * '_and_'}" elsif [:name] [:name] else raise ArgumentError, "You must specify the index name" end else legacy_index_name(table_name, ( )) end end