Hi, yes, I''m still using rails 1.2.6, as I haven''t made the time to migrate. when I try to do run tests using rake, it fails to initialize the database correctly.. I create the database using migrations, and I wanted to index a text field in mysql. The default add_index command does not handle adding the index correctly, as mysql requires a length for indexing a test field, for how much of the text field to index. so, in my migration I have a Model.connection.execute(''CREATE INDEX index_name ON table_name ( field1, field2, text_field(20) )'') however, rails records that in the schema.rb as add_index "table", ["field1","field2","text_field"], :name => "index_name" which fails. I don''t want to eliminate the index, as it gives me a considerable speed increase when looking for an exact match in the text_field.. Ideas? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 22 Apr 2008, at 18:27, CapnRegex wrote:> > Model.connection.execute(''CREATE INDEX index_name ON table_name > ( field1, field2, text_field(20) )'') > > however, rails records that in the schema.rb as > > add_index "table", ["field1","field2","text_field"], :name => > "index_name" > > which fails. > > I don''t want to eliminate the index, as it gives me a considerable > speed increase when looking for an exact match in the text_field..Switch from using the ruby schema dumper to the sql one (it''s an option in environment.rb) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yay, that worked, thanks.. just for the record, I added in Rails::Initializer.run do |config| ... stuff that was already there ... config.active_record.schema_format = :sql end On Apr 22, 11:54 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 22 Apr 2008, at 18:27, CapnRegex wrote: > > > > > Model.connection.execute(''CREATE INDEX index_name ON table_name > > ( field1, field2, text_field(20) )'') > > > however, rails records that in the schema.rb as > > > add_index "table", ["field1","field2","text_field"], :name => > > "index_name" > > > which fails. > > > I don''t want to eliminate the index, as it gives me a considerable > > speed increase when looking for an exact match in the text_field.. > > Switch from using the ruby schema dumper to the sql one (it''s an > option inenvironment.rb)--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---