aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-10-28 07:40:28 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-10-28 07:40:28 +0000
commit816f37a2adde4449a17712cb0891a15f2c2ea7c0 (patch)
tree43f33e8edc56816d3ff04dc44f641af6d77d416c /activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
parentcb0e27cee90c9417798c9d9db78dd0eb36c7fa24 (diff)
downloadrails-816f37a2adde4449a17712cb0891a15f2c2ea7c0.tar.gz
rails-816f37a2adde4449a17712cb0891a15f2c2ea7c0.tar.bz2
rails-816f37a2adde4449a17712cb0891a15f2c2ea7c0.zip
Added migration support to SQL Server adapter (please someone do the same for Oracle and DB2) (closes #2625) [Tom Ward]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2778 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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.rb14
1 files changed, 8 insertions, 6 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 366192909e..6a6f368210 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -184,23 +184,25 @@ module ActiveRecord
# remove_index :accounts, :column => :branch_id
# Remove the index named by_branch_party in the accounts table.
# remove_index :accounts, :name => :by_branch_party
+
def remove_index(table_name, options = {})
+ execute "DROP INDEX #{index_name(table_name, options)} ON #{table_name}"
+ end
+
+ def index_name(table_name, options) #:nodoc:
if Hash === options # legacy support
if options[:column]
- index_name = "#{table_name}_#{options[:column]}_index"
+ "#{table_name}_#{options[:column]}_index"
elsif options[:name]
- index_name = options[:name]
+ options[:name]
else
raise ArgumentError, "You must specify the index name"
end
else
- index_name = "#{table_name}_#{options}_index"
+ "#{table_name}_#{options}_index"
end
-
- execute "DROP INDEX #{index_name} ON #{table_name}"
end
-
# Returns a string of <tt>CREATE TABLE</tt> SQL statement(s) for recreating the
# entire structure of the database.
def structure_dump