aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2015-04-30 13:23:02 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2015-04-30 13:23:02 +0530
commit8e73f974598b27094a39e34489152e36054816f8 (patch)
tree81c5dafc0f19a902fffb22a575e760972cdfe69a /activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
parent9822ce2eb30308810d7371c7b22e87bf9cfb3989 (diff)
downloadrails-8e73f974598b27094a39e34489152e36054816f8.tar.gz
rails-8e73f974598b27094a39e34489152e36054816f8.tar.bz2
rails-8e73f974598b27094a39e34489152e36054816f8.zip
Added documentation for PostGreSQL database_statements [ci skip]
- Added documentation for index_name_exists? and rename_index. - Also changed rails to \Rails in documentation of allowed_index_name_length.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
index 168180cfd3..70fc1a6bd8 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
@@ -100,6 +100,7 @@ module ActiveRecord
SQL
end
+ # Verifies existence of an index with a given name.
def index_name_exists?(table_name, index_name, default)
exec_query(<<-SQL, 'SCHEMA').rows.first[0].to_i > 0
SELECT COUNT(*)
@@ -462,6 +463,8 @@ module ActiveRecord
execute "DROP INDEX #{quote_table_name(index_name)}"
end
+ # Renames an index of a table. Raises error if length of new
+ # index name is greater than allowed limit.
def rename_index(table_name, old_name, new_name)
validate_index_length!(table_name, new_name)