以下の内容はhttps://shuzo-kino.hateblo.jp/entry/2014/05/12/233908より取得しました。


ActiveRecordのmigration時にSQLのエンジンを選択する

たとえば、検索エンジンにmroongaを追加したい場合は
既存のdb/migrationの当該ファイルにoptions: "ENGINE = mroonga"を追加します

class CreateProfessors < ActiveRecord::Migration
  def change
    create_table :professors  ,options: "ENGINE = mroonga" do |t|
...
   end
...
end

これが終わったあとに

$ rake db:migrate:reset
$ rake db:seed

としてあげればよいです。

すでに動いているシステムの場合、上を実行すると再度作り直しになります。

その場合は

$ rails g use_mroonga_in_professors_table

として、別テーブルを作り

class UseMroongaInProfessorsTable < ActiveRecord::Migration
  def change
    execute <<-SQL
ALTER TABLE professors ENGINE = mroonga DEFAULT CHARSET utf8;
    SQL
   end
...
end

と別のカラムを追加してあげればよいです。




以上の内容はhttps://shuzo-kino.hateblo.jp/entry/2014/05/12/233908より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14