diff options
author | Michał Łomnicki <michal.lomnicki@gmail.com> | 2010-10-19 08:18:19 +0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-19 08:40:28 +0800 |
commit | 4120e95dce3ccea43ef9fb4bfeb513114f71ba9a (patch) | |
tree | 21a441bc963d65bae5e169a629bb255c86749b89 | |
parent | 541ed2b60db2be78e8a0ce763af73a3cc28da4db (diff) | |
download | rails-4120e95dce3ccea43ef9fb4bfeb513114f71ba9a.tar.gz rails-4120e95dce3ccea43ef9fb4bfeb513114f71ba9a.tar.bz2 rails-4120e95dce3ccea43ef9fb4bfeb513114f71ba9a.zip |
Use ALTER INDEX syntax to rename an index
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 4 |
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 |