Class: ActiveRecord::ConnectionAdapters::ColumnDefinition

Inherits:
Struct
  • Object
show all
Defined in:
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

Overview

Abstract representation of a column definition. Instances of this type are typically created by methods in TableDefinition, and added to the columns attribute of said TableDefinition object, in order to be used for generating a number of table creation or table changing SQL statements.

Direct Known Subclasses

PostgreSQLAdapter::ColumnDefinition

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#as_json, #to_h

Instance Attribute Details

#afterObject

Returns the value of attribute after

Returns:

  • (Object)

    the current value of after



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def after
  @after
end

#defaultObject

Returns the value of attribute default

Returns:

  • (Object)

    the current value of default



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def default
  @default
end

#firstObject

Returns the value of attribute first

Returns:

  • (Object)

    the current value of first



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def first
  @first
end

#limitObject

Returns the value of attribute limit

Returns:

  • (Object)

    the current value of limit



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def limit
  @limit
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def name
  @name
end

#nullObject

Returns the value of attribute null

Returns:

  • (Object)

    the current value of null



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def null
  @null
end

#precisionObject

Returns the value of attribute precision

Returns:

  • (Object)

    the current value of precision



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def precision
  @precision
end

#primary_keyObject

Returns the value of attribute primary_key

Returns:

  • (Object)

    the current value of primary_key



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def primary_key
  @primary_key
end

#scaleObject

Returns the value of attribute scale

Returns:

  • (Object)

    the current value of scale



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def scale
  @scale
end

#sql_typeObject

Returns the value of attribute sql_type

Returns:

  • (Object)

    the current value of sql_type



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def sql_type
  @sql_type
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



18
19
20
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 18

def type
  @type
end

Instance Method Details

#primary_key?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 20

def primary_key?
  primary_key || type.to_sym == :primary_key
end