aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorMichał Łomnicki <michal.lomnicki@gmail.com>2010-10-19 08:18:19 +0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-19 08:40:28 +0800
commit4120e95dce3ccea43ef9fb4bfeb513114f71ba9a (patch)
tree21a441bc963d65bae5e169a629bb255c86749b89 /activerecord
parent541ed2b60db2be78e8a0ce763af73a3cc28da4db (diff)
downloadrails-4120e95dce3ccea43ef9fb4bfeb513114f71ba9a.tar.gz
rails-4120e95dce3ccea43ef9fb4bfeb513114f71ba9a.tar.bz2
rails-4120e95dce3ccea43ef9fb4bfeb513114f71ba9a.zip
Use ALTER INDEX syntax to rename an index
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index a7503ccdc9..5949985e4d 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -849,6 +849,10 @@ module ActiveRecord
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