aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2012-12-15 22:42:22 +0100
committerYves Senn <yves.senn@garaio.com>2012-12-19 09:07:09 +0100
commitd01f913f8d21230b387c70d13b5646a838ba2915 (patch)
tree14302fc58da19088e127869496d4b5a998f4ae72 /activerecord/lib
parente68abc2c967d67a15fd99247bd00547d8bd3170d (diff)
downloadrails-d01f913f8d21230b387c70d13b5646a838ba2915.tar.gz
rails-d01f913f8d21230b387c70d13b5646a838ba2915.tar.bz2
rails-d01f913f8d21230b387c70d13b5646a838ba2915.zip
Keep index names when using with sqlite3
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
index b89e9a01a8..8aa5707959 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
@@ -537,7 +537,6 @@ module ActiveRecord
end
yield @definition if block_given?
end
-
copy_table_indexes(from, to, options[:rename] || {})
copy_table_contents(from, to,
@definition.columns.map {|column| column.name},
@@ -560,7 +559,7 @@ module ActiveRecord
unless columns.empty?
# index name can't be the same
- opts = { :name => name.gsub(/_(#{from})_/, "_#{to}_") }
+ opts = { name: name.gsub(/(^|_)(#{from})_/, "\\1#{to}_") }
opts[:unique] = true if index.unique
add_index(to, columns, opts)
end