With Rails 5, you can now directly add comments to your migration without using any plugin.
You can add comments to the table, column and index.
You can view these comments in schema.rb plus from the DBA tool.
Example:
class CreateProducts < ActiveRecord::Migration[5.0] def change create_table :products, comment: 'Products table' do |t| t.string :name, comment: 'Name of the product' t.string :barcode, comment: 'Barcode of the product' t.string :description, comment: 'Product details' t.float :msrp, comment: 'Maximum Retail Price' t.float :our_price, comment: 'Selling price' t.timestamps end add_index :products, :name, name: 'index_products_on_name', unique: true, comment: 'Index used to lookup product by name.' end end
Note. This is only supported for PostgreSQL and MySQL.
Prajakta
source share