Can anyone point me to the proper syntax to build a FULLTEXT MySQL index via migrations? I'm really liking these things, and don't want to step back into the world of manual intervention.
on 2006-03-04 18:53
on 2006-03-05 21:12
Michael G. wrote: > Can anyone point me to the proper syntax to build a FULLTEXT MySQL > index via migrations? > > I'm really liking these things, and don't want to step back into the > world of manual intervention. def self.up execute "your index sql goes here" end Since FULLTEXT indexes are most likely implemented differently across different servers, it is difficult for Schema to support them in a database agnostic way. So, I think this is a case where the "easy solution" is to just use SQL. A more long term solution may be to patch Rails (either through a plugin or a real patch) to support a wider variety of data types. -damon http://damonclinkscales.com/
on 2006-03-15 14:27
Michael, > Can anyone point me to the proper syntax to build a FULLTEXT MySQL > index via migrations? I had - almost a - success this morning with this migration : def self.up create_table "entity_extras" ,:options => "TYPE=MyISAM" do |t| t.column :entity_id , :integer t.column :extra , :text end execute "ALTER TABLE entity_extras ADD FULLTEXT(extra)" end I said "almost" because it worked fine outside of Rails (a match query would work in an external sql console, but it would prevent my unit test from running and throw an 1170 error. Mysql error: BLOB column 'extra' used in key specification without a key length http://www.mysqlfreaks.com/errors/275.php I could make it work with :string but not with :text !! I'll try again next week.. Alain