class XMigra::DeclarativeSupport::Table::Column

Constants

SPEC_ATTRS

Attributes

default_constraint[RW]

Public Class Methods

new(col_spec) click to toggle source
# File lib/xmigra/declarative_support/table.rb, line 81
def initialize(col_spec)
  @primary_key = !!col_spec['primary key']
  @nullable = !!col_spec.fetch('nullable', true)
  SPEC_ATTRS.each do |a|
    instance_variable_set("@#{a}".to_sym, col_spec[a.to_s])
  end
  if default = col_spec['default']
    @default_constraint = DefaultConstraint.new(
      "DF_#{name}",
      StructureReader.new({
        'column'=>name,
        'value'=>default
      })
    )
  end
end

Public Instance Methods

nullable=(value) click to toggle source
# File lib/xmigra/declarative_support/table.rb, line 111
def nullable=(value)
  @nullable = value
end
nullable?() click to toggle source
# File lib/xmigra/declarative_support/table.rb, line 108
def nullable?
  @nullable
end
primary_key=(value) click to toggle source
# File lib/xmigra/declarative_support/table.rb, line 104
def primary_key=(value)
  @primary_key = value
end
primary_key?() click to toggle source
# File lib/xmigra/declarative_support/table.rb, line 101
def primary_key?
  @primary_key
end