Rails by default uses the InnoDB engine, but MySQL full-text indexing is only supported by the MyISAM table type.
So, first we’ll have to convert our target table over to MyISAM. Next we add the full-text index on several columns.
class FullTextSearch < ActiveRecord::Migration
def self.up
execute 'ALTER TABLE torrents ENGINE = MyISAM'
execute 'CREATE FULLTEXT INDEX ft_idx_torrents ON torrents(name,filename,description)'
end
def self.down
execute 'ALTER TABLE torrents DROP INDEX ft_idx_torrents'
execute 'ALTER TABLE torrents ENGINE = InnoDB'
end
end
This is the actual migration used in The Hydra Project to add full-text searching support of torrents.








This will work, but the fulltext index will not make it to the schema.rb. To do that you need to extend/override the the def indexes() method in ActiveRecord::SchemaDumper
Great!