aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
diff options
context:
space:
mode:
authorSteve Rice <steve@steverice.org>2014-03-25 21:13:29 -0700
committerSteve Rice <steve@pagerduty.com>2014-03-25 22:10:43 -0700
commit63c94efccb20c0b398dd90c0d209d6894eb22d92 (patch)
tree2717390d594069f6c82e8c9eb7f98eecebe7c07f /activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
parentafa148a4f0ac5e2a446b5fe87881a130e8a24f3d (diff)
downloadrails-63c94efccb20c0b398dd90c0d209d6894eb22d92.tar.gz
rails-63c94efccb20c0b398dd90c0d209d6894eb22d92.tar.bz2
rails-63c94efccb20c0b398dd90c0d209d6894eb22d92.zip
Fixes bugs for using indexes in CREATE TABLE by adding checks for table existence
Also: - updates tests by stubbing table_exists? method - adds entry for creating indexes in CREATE TABLE to changelog
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 59210c345f..23404a5c48 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -795,7 +795,7 @@ module ActiveRecord
if index_name.length > max_index_length
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' is too long; the limit is #{max_index_length} characters"
end
- if index_name_exists?(table_name, index_name, false)
+ if table_exists?(table_name) && index_name_exists?(table_name, index_name, false)
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' already exists"
end
index_columns = quoted_columns_for_index(column_names, options).join(", ")