Module: MigrationComments::ActiveRecord::ConnectionAdapters::AlterTable

Defined in:
lib/migration_comments/active_record/connection_adapters/alter_table.rb

Instance Method Summary collapse

Instance Method Details

#add_column(name, type, options) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/migration_comments/active_record/connection_adapters/alter_table.rb', line 3

def add_column(name, type, options)
  super(name, type, options)
  if options.keys.include?(:comment)
    added_entity = @adds.last
    column = added_entity.respond_to?(:column) ? added_entity.column : added_entity
    column.comment = CommentDefinition.new(@td, name, options[:comment])
  end
end