I looked at this change because I was interested as well.
Revision 4768, 11.1 kB (checked in by bitsweat, 5 months ago)
http://dev.rubyonrails.org/changeset/4768
"Make indexed columns easy to extract from the index name. Oracle
users should explicitly assign index names due to field length
restrictions. "
In the same commit nothing was added to manage the "old style" indexes
so I think you have to work around it or check the commit after that.
Maybe you can just wrap the remove_index in a method that rescue the
exception if the index is not found and retries generating the old
style index.
Paolo
On 22/01/07, Wiliam Langshaw
<wlangshaw-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> So I upgraded to Rails 1.2.1 and off the bat did a
>
> > rake db:migrate VERSION=0
>
> to start all fresh and clean.
>
> Right away it failed in my first migration''s down() method,
because it
> couldnt find the index in remove_index().
>
> I got into my MySQL DB and sure enough the indexes were there. Long
> story short, I looked at:
>
>
vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
>
> And there is an obvious change in the way the method "index_name"
works
> to generate the index name to either add or remove depending on your
> context.
>
> In a nutshell:
>
> Rails 1.1.6: remove_index :users, :email -> looks for an index named
> "users_email_index"
> Rails 1.2.1: remove_index :users, :email -> looks for an index named
> "index_users_email"
>
> So of course Rails 1.2.1 isnt going to find this index, because it was
> created with Rails 1.1.6.
>
> Now, this is one thing. But looking through the ActiveRecord CHANGELOG,
> there is NO mention of this, much less a way to fix it without manually
> going into all my migrations and specifying the name of the index by
> hand (rather than having Rails try to auto-generate the index name).
>
> Is there something I am missing here?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---