---------
Anyway thanks for the suggestion above.

I verified that the command you suggest is really reporting the
correct index names:
ActiveRecord::Base.connection.indexes(:enrollments)

[#<struct ActiveRecord::ConnectionAdapters::IndexDefinition
table=:enrollments, name="index_team_participations_on_event_id",
unique=false, columns=["event_id"], lengths=nil>, #<struct
ActiveRecord::ConnectionAdapters::IndexDefinition table=:enrollments,
name="index_enrollments_on_event_id", unique=false,
columns=["event_id"], lengths=nil>, #<struct
ActiveRecord::ConnectionAdapters::IndexDefinition table=:enrollments,
name="index_team_participations_on_country_id", unique=false,
columns=["country_id"], lengths=nil>, #<struct
ActiveRecord::ConnectionAdapters::IndexDefinition table=:enrollments,
name="index_enrollments_on_country_id", unique=false,
columns=["country_id"], lengths=nil>, #<struct
ActiveRecord::ConnectionAdapters::IndexDefinition table=:enrollments,
name="index_team_participations_on_boat_id", unique=false,
columns=["boat_id"], lengths=nil>, #<struct
ActiveRecord::ConnectionAdapters::IndexDefinition table=:enrollments,
name="index_enrollments_on_boat_id", unique=false,
columns=["boat_id"], lengths=nil>, #<struct
ActiveRecord::ConnectionAdapters::IndexDefinition table=:enrollments,
name="index_team_participations_on_boat_id_and_event_id", unique=true,
columns=["boat_id", "event_id"], lengths=nil>, #<struct
ActiveRecord::ConnectionAdapters::IndexDefinition table=:enrollments,
name="index_enrollments_on_boat_id_and_event_id", unique=true,
columns=["boat_id", "event_id"], lengths=nil>]

It's really remove_index commands in the migration itself are doing
nothing.
---------
Manually deleting is really hopeless. We were trying to do some team
work. 5 developers are committing hobo migrations.
---------
Some thoughts. Such a problem would never happen if you were using
manually written migrations... And no one serious is using sqlite3
except in development anyway... However, Hobo is generating the
indexes correctly relative to the current database... And never
deleted indexes are becoming a problem... Also I have to admit that
it's worth trying in other versions of Rails.
---------
The next thing to do is to set a debugger on remove_index to see where
it goes... I found out that a migration class does not call the
remove_index implementation in sqlite adapter of rails. I inserted a
raise into the sqlite adapter itself.

Is there a way to run migrations in a debugger?

On Feb 1, 8:23 pm, Matt Jones <[email protected]> wrote:
> On Feb 1, 2011, at 1:25 PM, umuro wrote:
>
>
>
>
>
>
>
>
>
> > Rails 2.3.8
> > sqlite3 1.3.3
>
> > If we run any migration (rake db:migrate) that includes a
> > "remove_index" statement then the index still stays in the sqlite3
> > datebase.
>
> > No errors or exceptions are recieved during the execution.
>
> > Examples:
>
> > remove_index :enrollments, :name
> > => :index_team_participations_on_event_id
> > remove_index :enrollments, :name
> > => :index_team_participations_on_country_id
> > remove_index :enrollments, :name
> > => :index_team_participations_on_boat_id
> > remove_index :enrollments, :name
> > => :index_team_participations_on_boat_id_and_event_id
> > Table names and index names were correct in our experiment.
>
> This is not quite what's in the ticket:
>
> https://rails.lighthouseapp.com/projects/8994/tickets/6356
>
> The above statements would *definitely* not work, as they'll be looking for 
> indexes named index_enrollments_on_name etc, while the ticket #6356 version 
> has explicit names.
>
> Do you get any messages in the log? The 2.3.8 remove_index stuff was tweaked 
> to complain when an index was missing instead of blowing up (as it was very 
> bad for MySQL, etc to have a half-complete migration).
>
> In the meantime, you might want to try manually dropping the indexes in your 
> favorite SQLite3 commandline or GUI. Before that, though, for debugging it 
> would be helpful to have the output of this command:
>
> ActiveRecord::Base.connection.indexes(:enrollments)
>
> to see if Rails and/or Hobo are getting confused.
>
> --Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to