mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Provide data for the key column otherwise adding a unique index will fail. [#30 state:closed]
This commit is contained in:
parent
bf1b1e0925
commit
ae51013c3f
1 changed files with 1 additions and 0 deletions
|
@ -79,6 +79,7 @@ if ActiveRecord::Base.connection.supports_migrations?
|
|||
# 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) }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue