Browse files

Provide data for the key column otherwise adding a unique index will …

…fail. [#30 state:closed]
  • Loading branch information...
fcheung authored and NZKoz committed Apr 23, 2008
1 parent bf1b1e0 commit ae51013c3f7b8a8579fcb99d889ed80e9dd75797
Showing with 1 addition and 0 deletions.
  1. +1 −0 activerecord/test/cases/migration_test.rb
@@ -79,6 +79,7 @@ def test_add_index
# Note: changed index name from "key" to "key_idx" since "key" is a Firebird reserved word
# OpenBase does not have named indexes. You must specify a single column name
unless current_adapter?(:OpenBaseAdapter)
+ 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)
assert_nothing_raised { Person.connection.add_index("people", ["key"], :name => "key_idx", :unique => true) }
assert_nothing_raised { Person.connection.remove_index("people", :name => "key_idx", :unique => true) }

0 comments on commit ae51013

Please sign in to comment.