Module: ActiveRecord::ConnectionAdapters::ColumnDumper

Defined in:
lib/active_record/connection_adapters/ibm_db_adapter.rb

Instance Method Summary collapse

Instance Method Details

#prepare_column_options(column) ⇒ Object



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 513

def prepare_column_options(column)
  puts_log 'prepare_column_options'
  spec = {}

  if limit = schema_limit(column)
    spec[:limit] = limit
  end

  if precision = schema_precision(column)
    spec[:precision] = precision
  end

  if scale = schema_scale(column)
    spec[:scale] = scale
  end

  default = schema_default(column) if column.has_default?
  spec[:default] = default unless default.nil?
  spec[:null] = 'false' unless column.null

  if collation = schema_collation(column)
    spec[:collation] = collation
  end

  spec[:comment] = column.comment.inspect if column.comment.present?

  spec
end

#schema_limit(column) ⇒ Object



542
543
544
545
546
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 542

def schema_limit(column)
  puts_log 'schema_limit'
  limit = column.limit unless column.bigint?
  limit.inspect if limit && limit != native_database_types[column.type.to_sym][:limit]
end