I''m using the acts as taggable on plugin, and in the migrations there''s a line of code to create an index: add_index :taggings, [:taggable_id, :taggable_type, :context], :name => "tagging_index", :limit => {:name => 10, :surname => 20} When I use unicode, the migration fails and I get told that the index is too long and can only be 1000 bytes. I switched over to ascii to see if I get the same problem and I didn''t. I really want to use unicode, so I want to get this working. I''m running Rails 3.0.7 with MySQL 5.1. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 23, 11:23 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using the acts as taggable on plugin, and in the migrations > there''s a line of code to create an index: > > add_index :taggings, [:taggable_id, :taggable_type, :context], :name > => "tagging_index", :limit => {:name => 10, :surname => 20} > > When I use unicode, the migration fails and I get told that the index > is too long and can only be 1000 bytes. I switched over to ascii to > see if I get the same problem and I didn''t. I really want to use > unicode, so I want to get this working.If you want to limit the length of the prefix used for indexes, you''ll need to change name/surname up there for the string columns you want to index (ie taggable_type and context) and change the numbers as appropriate to your data Fred> > I''m running Rails 3.0.7 with MySQL 5.1.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
How can I use the :limit to change taggable_ type and context? On Apr 24, 12:32 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 23, 11:23 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m using the acts as taggable on plugin, and in the migrations > > there''s a line of code to create an index: > > > add_index :taggings, [:taggable_id, :taggable_type, :context], :name > > => "tagging_index", :limit => {:name => 10, :surname => 20} > > > When I use unicode, the migration fails and I get told that the index > > is too long and can only be 1000 bytes. I switched over to ascii to > > see if I get the same problem and I didn''t. I really want to use > > unicode, so I want to get this working. > > If you want to limit the length of the prefix used for indexes, you''ll > need to change name/surname up there for the string columns you want > to index (ie taggable_type and context) and change the numbers as > appropriate to your data > > Fred > > > > > > > I''m running Rails 3.0.7 with MySQL 5.1.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 24, 9:23 am, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How can I use the :limit to change taggable_ type and context?The limit tells mysql how much of the column to use for the index. Pick values such that your total index length falls within the limit (you''re probably better off picking a smaller value for taggable_type, you''re very unlikely to have massively long values in that column) Fred> > On Apr 24, 12:32 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > On Apr 23, 11:23 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''m using the acts as taggable on plugin, and in the migrations > > > there''s a line of code to create an index: > > > > add_index :taggings, [:taggable_id, :taggable_type, :context], :name > > > => "tagging_index", :limit => {:name => 10, :surname => 20} > > > > When I use unicode, the migration fails and I get told that the index > > > is too long and can only be 1000 bytes. I switched over to ascii to > > > see if I get the same problem and I didn''t. I really want to use > > > unicode, so I want to get this working. > > > If you want to limit the length of the prefix used for indexes, you''ll > > need to change name/surname up there for the string columns you want > > to index (ie taggable_type and context) and change the numbers as > > appropriate to your data > > > Fred > > > > I''m running Rails 3.0.7 with MySQL 5.1.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oh, I was looking for an example of how to use it like a piece of code or something. On Apr 24, 7:51 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Apr 24, 9:23 am, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > How can I use the :limit to change taggable_ type and context? > > The limit tells mysql how much of the column to use for the index. > Pick values such that your total index length falls within the limit > (you''re probably better off picking a smaller value for taggable_type, > you''re very unlikely to have massively long values in that column) > > Fred > > > > > > > On Apr 24, 12:32 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > On Apr 23, 11:23 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I''m using the acts as taggable on plugin, and in the migrations > > > > there''s a line of code to create an index: > > > > > add_index :taggings, [:taggable_id, :taggable_type, :context], :name > > > > => "tagging_index", :limit => {:name => 10, :surname => 20} > > > > > When I use unicode, the migration fails and I get told that the index > > > > is too long and can only be 1000 bytes. I switched over to ascii to > > > > see if I get the same problem and I didn''t. I really want to use > > > > unicode, so I want to get this working. > > > > If you want to limit the length of the prefix used for indexes, you''ll > > > need to change name/surname up there for the string columns you want > > > to index (ie taggable_type and context) and change the numbers as > > > appropriate to your data > > > > Fred > > > > > I''m running Rails 3.0.7 with MySQL 5.1.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Nevermind, I got it. I just have to test to see if it works. Thanks for your help! On Apr 24, 3:49 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Oh, I was looking for an example of how to use it like a piece of code > or something. > > On Apr 24, 7:51 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > On Apr 24, 9:23 am, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > How can I use the :limit to change taggable_ type and context? > > > The limit tells mysql how much of the column to use for the index. > > Pick values such that your total index length falls within the limit > > (you''re probably better off picking a smaller value for taggable_type, > > you''re very unlikely to have massively long values in that column) > > > Fred > > > > On Apr 24, 12:32 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > On Apr 23, 11:23 pm, Mike C <snib...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > I''m using the acts as taggable on plugin, and in the migrations > > > > > there''s a line of code to create an index: > > > > > > add_index :taggings, [:taggable_id, :taggable_type, :context], :name > > > > > => "tagging_index", :limit => {:name => 10, :surname => 20} > > > > > > When I use unicode, the migration fails and I get told that the index > > > > > is too long and can only be 1000 bytes. I switched over to ascii to > > > > > see if I get the same problem and I didn''t. I really want to use > > > > > unicode, so I want to get this working. > > > > > If you want to limit the length of the prefix used for indexes, you''ll > > > > need to change name/surname up there for the string columns you want > > > > to index (ie taggable_type and context) and change the numbers as > > > > appropriate to your data > > > > > Fred > > > > > > I''m running Rails 3.0.7 with MySQL 5.1.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.