diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-19 03:33:51 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-12-19 03:33:51 -0800 |
commit | bf166996f2985c7952b1d27ba4c1789f6b6e4161 (patch) | |
tree | 6ad4736a3358305efff45b821e5afa965bb9d546 /activerecord/lib/active_record | |
parent | df048b574b5ab5a449a3b1dfc50dbf3baa18869e (diff) | |
parent | 9f69d42860a56c585271484f49445f1b43dac357 (diff) | |
download | rails-bf166996f2985c7952b1d27ba4c1789f6b6e4161.tar.gz rails-bf166996f2985c7952b1d27ba4c1789f6b6e4161.tar.bz2 rails-bf166996f2985c7952b1d27ba4c1789f6b6e4161.zip |
Merge pull request #8558 from senny/backport_3489
Backport #8522, Keep index names when using with sqlite3
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index e80b465bab..ca84c95bdc 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -530,7 +530,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 |