aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman@gmail.com>2015-04-30 06:47:27 -0500
committerRichard Schneeman <richard.schneeman@gmail.com>2015-04-30 06:47:27 -0500
commita000e5c455ba70e782ce3700beb9913999bb8c62 (patch)
tree661dbc32092bf3289595378d3197729b06d16166 /activerecord
parent79c4aac5525b950676ef1e859f85c6d18e8a2be3 (diff)
parent8e73f974598b27094a39e34489152e36054816f8 (diff)
downloadrails-a000e5c455ba70e782ce3700beb9913999bb8c62.tar.gz
rails-a000e5c455ba70e782ce3700beb9913999bb8c62.tar.bz2
rails-a000e5c455ba70e782ce3700beb9913999bb8c62.zip
Merge pull request #19961 from prathamesh-sonpatki/pg-docs
Added documentation for PostGreSQL database_statements [ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb4
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb3
2 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb
index c0a2111571..30b2fca2ca 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb
@@ -18,9 +18,9 @@ module ActiveRecord
end
# Returns the maximum allowed length for an index name. This
- # limit is enforced by rails and Is less than or equal to
+ # limit is enforced by \Rails and is less than or equal to
# <tt>index_name_length</tt>. The gap between
- # <tt>index_name_length</tt> is to allow internal rails
+ # <tt>index_name_length</tt> is to allow internal \Rails
# operations to use prefixes in temporary operations.
def allowed_index_name_length
index_name_length
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)