/activerecord-mysql-comment

Adds column comment and index comment to migrations for ActiveRecord MySQL adapters

Primary LanguageRubyMIT LicenseMIT

ActiveRecord::Mysql::Comment

Build Status

Adds column comment and index comment to migrations for ActiveRecord MySQL adapters

Installation

Add this line to your application's Gemfile:

gem 'activerecord-mysql-comment'

And then execute:

$ bundle

Or install it yourself as:

$ gem install activerecord-mysql-comment

Usage

bundle exec rails g migration CreatePosts
class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts, options: 'ENGINE=Mroonga COMMENT="default_tokenizer=TokenMecab"' do |t|
      t.string :title
      t.text   :content, comment: 'flags "COLUMN_SCALAR|COMPRESS_ZLIB"'
      t.timestamps
    end
    add_index :posts, :content, type: 'fulltext', comment: 'parser "TokenBigram", normalizer "NormalizerAuto"'
  end
end
bundle exec rake db:migrate
  create_table "posts", force: :cascade, options: "ENGINE=Mroonga DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='default_tokenizer=TokenMecab'" do |t|
    t.string   "title",      limit: 255
    t.text     "content",    limit: 65535, comment: "flags \"COLUMN_SCALAR|COMPRESS_ZLIB\""
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "posts", ["content"], name: "index_posts_on_content", type: :fulltext, comment: "parser \"TokenBigram\", normalizer \"NormalizerAuto\""

Note

Contributing

  1. Fork it ( https://github.com/naoa/activerecord-mysql-comment/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Thanks

This library is made by referring to activerecord-mysql-awesome.