Michael Gorsuch
2006-Mar-04 16:53 UTC
[Rails] Using Migrations to Build a MySQL FULLTEXT index?
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.
Damon Clinkscales
2006-Mar-05 19:12 UTC
[Rails] Re: Using Migrations to Build a MySQL FULLTEXT index?
Michael Gorsuch 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/ -- Posted via http://www.ruby-forum.com/.
Alain Ravet
2006-Mar-15 12:25 UTC
[Rails] Using Migrations to Build a MySQL FULLTEXT index?
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