Ruby Forum Rails I18n > Indentifier name too long

Posted by Dylan Stamat (Guest)
on 05.09.2006 09:57
(Received via mailing list)
Running Edge (4991) and MySQL (5.0.22)
==============================

When running "rake db:migrate"

Mysql::Error: Identifier name
'index_globalize_translations_on_table_name_and_item_id_and_language_id' 
is
too long: CREATE  INDEX
`index_globalize_translations_on_table_name_and_item_id_and_language_id` 
ON
globalize_translations (`table_name`, `item_id`, `language_id`)
Posted by Martin Bernd Schmeil (thebernd)
on 05.09.2006 10:20
Just add a

:name => â??something_idxâ??

parameter to the add_index statement.

Btw. If you have the same problem with foreign_keys:

1)       create an index with a shorter name
2)       add_fkey â?¦, :name => â??something_fkâ?, :index => false

does the trick.

Also you can handle the identifier name limit for the foreign key itself 
and index with a possibly too long name will be auto created â?¦unless you 
use the :index => false option. On most (all?) RDBMS you need an index 
for foreign keys column(s) though.

- Bernd
Posted by Tim Perrett (timperrett)
on 09.09.2007 14:05
FYI - this is on line 71 of data.rake in the globalize directory

Cheers

Tim


Martin Bernd Schmeil wrote:
> Just add a
> 
> :name => �??something_idx�??