I should mention that this error is arising from my schema.rb when I try to 
do a *rake db:schema:load* to migrate to PostgreSQL:

  create_table "document_other_related_instruments", :force => true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "document_id"
    t.integer  "other_related_instrument_id"
  end

  add_index "document_other_related_instruments", ["document_id"], :name => 
"index_document_other_related_instruments_on_document_id"
  add_index "document_other_related_instruments", 
["other_related_instrument_id"], :name => "
*index_document_other_related_instruments_on_other_related_instru*"

And, the name here is quite definitely 64 characters. 

But, now I'm not sure if this is an *historical* problem - an index created 
in my MySQL database some time ago that has persisted as valid for MySQL 
(being max of 64 characters long), but invalid for PostgreSQL (which can't 
exceed 63 characters)? 

I see 
here<http://postgresql.1045698.n5.nabble.com/NAME-maximum-length-in-bytes-td5695932.html>,
 
that PostgreSQL docs mention for the max length of an index name:

*Its length is currently defined as 64 bytes (63 usable characters 
plus terminator).*

My obvious work-around is to change the name in my schema.rb file, so 
perhaps I'm just chasing my tail. 

Tim





On Sunday, January 26, 2014 3:32:38 PM UTC-5, Tim Griffin wrote:
>
> Hi Ignacio;
>
> I have *document.rb:*
> class Document < ActiveRecord::Base
>   hobo_model
>   ...
>  # Other instruments referenced by this document
>   has_many    :document_other_related_instruments, :accessible => true 
>   has_many    :other_related_instruments, :class_name => "Instrument", 
> :through => :document_other_related_instruments
> end
>
> and *document_other_related_instrument.rb*
> class DocumentOtherRelatedInstrument < ActiveRecord::Base
>
>   hobo_model
>   ...
>   belongs_to :document
>   belongs_to    :other_related_instrument, :class_name => "Instrument"
> ...
> end
>
> Gives me:
>
> -- 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
>
 

> 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.

Reply via email to