Revision c1c9649b
Added by Daniel Lobato Garcia almost 9 years ago
db/migrate/20131021152315_change_name_index_on_fact_name.rb | ||
---|---|---|
class ChangeNameIndexOnFactName < ActiveRecord::Migration
|
||
def up
|
||
remove_index :fact_names, :column => :name, :unique => true
|
||
options = ActiveRecord::Base.connection.instance_values["config"][:adapter].grep(/mysql/).any? ?
|
||
{ :unique => true, :length => 254 } :
|
||
{ :unique => true }
|
||
options = if ActiveRecord::Base.connection.instance_values["config"][:adapter].grep(/mysql/).any?
|
||
{ :unique => true, :length => 254 }
|
||
else
|
||
{ :unique => true }
|
||
end
|
||
add_index :fact_names, [:name, :type], options
|
||
end
|
||
|
||
def down
|
||
remove_index :fact_names, [:name, :type]
|
||
options = ActiveRecord::Base.connection.instance_values["config"][:adapter].grep(/mysql/).any? ?
|
||
{ :unique => true, :length => 254 } :
|
||
{ :unique => true }
|
||
options = if ActiveRecord::Base.connection.instance_values["config"][:adapter].grep(/mysql/).any?
|
||
{ :unique => true, :length => 254 }
|
||
else
|
||
{ :unique => true }
|
||
end
|
||
add_index :fact_names, :name, options
|
||
end
|
||
end
|
Also available in: Unified diff
Refs #3809 - Enable cop Style/MultilineTernaryOperator