Permalink
Browse files

Use ALTER INDEX syntax to rename an index

  • Loading branch information...
1 parent 541ed2b commit 4120e95dce3ccea43ef9fb4bfeb513114f71ba9a @mlomnicki mlomnicki committed with tenderlove Oct 19, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -849,6 +849,10 @@ def remove_index!(table_name, index_name) #:nodoc:
execute "DROP INDEX #{quote_table_name(index_name)}"
end
+ def rename_index(table_name, old_name, new_name)
+ execute "ALTER INDEX #{quote_column_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
+ end
+
def index_name_length
63
end

0 comments on commit 4120e95

Please sign in to comment.