Hi,
to fix bug #7038: "PGError when hostgroup name exceeds 245 characters"
I needed to change the column 'match' in lookup_values from string to text.
The problem is that there is an index on that column.
There are two kinds of migrations that deal with this problem:
- 20101018120548_create_messages.rb:
if ActiveRecord::Base.connection.instance_values["config"][:adapter] ==
"mysql" or
ActiveRecord::Base.connection.instance_values["config"][:adapter] ==
"mysql2"
execute "ALTER TABLE messages ENGINE = MYISAM"
execute "ALTER TABLE messages ADD FULLTEXT (value)"
else
add_index :messages, :value
end
the 'add_index' doesn't show up on schema.rb.
Isn't that a little confusing?
- 20131021152315_change_name_index_on_fact_name.rb:
options =
ActiveRecord::Base.connection.instance_values["config"][:adapter].grep(/mysql/).any?
?
{ :unique => true, :length => 254 } :
{ :unique => true }
add_index :fact_names, [:name, :type], options
I was wondering about the :length => 254:
when adding limit to 'name' does that mean if there is a name (it's a text
field) longer then 254 characters we don't allow it when using mysql?
so only mysql users will get an error and others can create longer names?
what about trying to save a name when connected to mysql when there is
already a long name in the table?