That's weird Tim,

It certainly looks like a bug in Hobo, I believe
@model.connection.index_name_length will return "63" with PostgreSQL, so
Hobo should not try to create index names with 64 characters.

Can you give me a bit more info about your model names/relationships so
I can reproduce it with the closest example as possible?

Warm regards,
Ignacio

El 26/01/14 15:11, Tim Griffin escribió:
> Hmm... seems like an issue with the activerecord PostgreSQL adapter:
> 
> https://rails.lighthouseapp.com/projects/8994/tickets/6187-postgresql-and-rails-303-migrations-fail-with-index-name-length-64-chars
> 
> and I see that Hobo simply inquires about the max length from the
> model's connection (in index_spec.rb):
> 
>         if check_name.length > @model.connection.index_name_length
>           r += ", :name => '#{name[0,@model.connection.index_name_length]}'"
>           $stderr.puts("WARNING: index name #{check_name} too long,
> trimming")
> 
> So, if this is the case, is there any way for me to intervene in the
> name that HObo's migration generator comes up with?
> 
> Or, should Hobo be using index_name_length-1 ? 
> 
> Tim
> 
> 
> 
> 
> 
> On Sunday, January 26, 2014 9:01:46 AM UTC-5, Tim Griffin wrote:
> 
>     Hi all;
> 
>     I'm migrating an application from MySQL to PostgreSQL and I'm
>     hitting cases where my lengthy model names are triggering index
>     names that are too long for PostgreSQL:
> 
>     -- add_index("document_other_related_instruments", ["document_id"],
>     {:name=>"index_document_other_related_instruments_on_document_id"})
>        -> 0.0019s
>     -- add_index("document_other_related_instruments",
>     ["other_related_instrument_id"],
>     
> {:name=>"index_document_other_related_instruments_on_other_related_instru"})
>     rake aborted!
>     Index name
>     'index_document_other_related_instruments_on_other_related_instru'
>     on table 'document_other_related_instruments' is too long; the limit
>     is 63 characters
> 
>     The generated index name is being truncated at 64 characters long
>     instead of 63 - perhaps Hobo is missing the truncation by one
>     character? I will investigate for a bug. 
> 
>     If it's not a bug, can anyone tell me how to override the
>     hobo-generated index name? I can see how to do it within a Rails
>     migration, but I don't see any reference to controlling the
>     migrations that Hobo generates in the Hobo Manual, and this thread
>     <https://groups.google.com/d/topic/hobousers/CzVCrHNkXoA/discussion>
>     hasn't had any followup since 2009. 
> 
>     Many thanks,
>     Tim
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to