public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Provide data for the key column otherwise adding a unique index will fail. 
[#30 state:closed]
fcheung (author)
Tue Apr 22 19:23:53 -0700 2008
NZKoz (committer)
Tue Apr 22 19:24:20 -0700 2008
commit  ae51013c3f7b8a8579fcb99d889ed80e9dd75797
tree    fc347139364aead58aeaae74a915e71ac07b25d4
parent  bf1b1e0925085811f0b58bb4093e678438ea0236
...
79
80
81
 
82
83
84
...
79
80
81
82
83
84
85
0
@@ -79,6 +79,7 @@
0
       # Note: changed index name from "key" to "key_idx" since "key" is a Firebird reserved word
0
       # OpenBase does not have named indexes. You must specify a single column name
0
       unless current_adapter?(:OpenBaseAdapter)
0
+ Person.update_all "#{Person.connection.quote_column_name 'key'}=#{Person.connection.quote_column_name 'id'}" #some databases (including sqlite2 won't add a unique index if existing data non unique)
0
         assert_nothing_raised { Person.connection.add_index("people", ["key"], :name => "key_idx", :unique => true) }
0
         assert_nothing_raised { Person.connection.remove_index("people", :name => "key_idx", :unique => true) }
0
       end

Comments

    No one has commented yet.