instance method
rename_index
Ruby on Rails 7.2.3
Since v4.2.9Signature
rename_index(table_name, old_name, new_name)
Renames an index of a table. Raises error if length of new index name is greater than allowed limit.
Parameters
-
table_namereq -
old_namereq -
new_namereq
Source
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 522
def rename_index(table_name, old_name, new_name)
validate_index_length!(table_name, new_name)
schema, = extract_schema_qualified_name(table_name)
execute "ALTER INDEX #{quote_table_name(schema) + '.' if schema}#{quote_column_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb line 522
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements