On May 22, 11:16 am, Colin Steele <[email protected]> wrote: > Got another one... Dumper is creating: > > create_table(:hotelReviewSearchIndex) do > Integer :hotelReviewId, :null=>false > String :reviewSearchIndex, :text=>true, :null=>false > > index [:hotelReviewId], :name=>:hotelRevIdInd > index [:reviewSearchIndex], :name=>:reviewSearch > end > > And on load to mysql, it errors out: > > Mysql::Error BLOB/TEXT column 'reviewSearchIndex' used in key > specification without a key length
MySQL sucks. :( Anyway, I'm not sure how best to handle this. It looks fairly easy to parse out the key lengths from the SHOW INDEXES results, but what would we do on when copying from say PostgreSQL to MySQL, where the text column in PostgreSQL has an index? I'm leaning toward not outputting the index if it is only partly indexed, since it isn't really portable and I'd have to add a significant amount of code to support it. If someone else wants to work on a patch to the shared MySQL adapter to parse out key lengths to a different hash key and have them applied correctly, I'd consider that as it shouldn't have a negative effect when used on other databases (other than indexing the whole column instead of just part of it). To get the PostgreSQL->MySQL migration working, the only workable option is probably executing each CREATE INDEX statement in a begin/ rescue block that ignores any DatabaseErrors generated (maybe only in non-unique cases). Indexes aren't required for correct operation (at least in the non unique case), so a failure to create one shouldn't necessarily raise an error. The reality is that Sequel can only do so much in this area without getting very complex, and I don't want Sequel to get very complex. You shouldn't expect Sequel to be able to do a migration perfectly if you are relying on database specific features, there's just too many variables involved. That being said, I'll try to improve support where I can do so without much difficulty, and I'm always happy to accept patches. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" 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/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
