Class: ActiveRecord::ConnectionAdapters::Hanaclient::TableDefinition

Inherits:
TableDefinition
  • Object
show all
Includes:
ColumnMethods
Defined in:
lib/active_record/connection_adapters/hanaclient/schema_definitions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ColumnMethods

#primary_key

Constructor Details

#initialize(name, temporary = false, row_table = false, options = nil, as = nil, comment: nil) ⇒ TableDefinition



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 42

def initialize(name, temporary = false, row_table = false, options = nil, as = nil, comment: nil)
  @columns_hash = {}
  @indexes = []
  @foreign_keys = []
  @primary_keys = nil
  @row_table = row_table
  @temporary = temporary
  @options = options
  @as = as
  @name = name
  @comment = comment
end

Instance Attribute Details

#asObject (readonly)

Returns the value of attribute as.



40
41
42
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 40

def as
  @as
end

#commentObject (readonly)

Returns the value of attribute comment.



40
41
42
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 40

def comment
  @comment
end

#foreign_keysObject (readonly)

Returns the value of attribute foreign_keys.



40
41
42
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 40

def foreign_keys
  @foreign_keys
end

#indexesObject

Returns the value of attribute indexes.



39
40
41
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 39

def indexes
  @indexes
end

#nameObject (readonly)

Returns the value of attribute name.



40
41
42
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 40

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



40
41
42
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 40

def options
  @options
end

#row_tableObject (readonly)

Returns the value of attribute row_table.



40
41
42
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 40

def row_table
  @row_table
end

#temporaryObject (readonly)

Returns the value of attribute temporary.



40
41
42
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 40

def temporary
  @temporary
end

Instance Method Details

#new_column_definition(name, type, **options) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/active_record/connection_adapters/hanaclient/schema_definitions.rb', line 56

def new_column_definition(name, type, **options)
  if type == :primary_key
    type = :integer
    options[:limit] ||= 8
    options[:auto_increment] = true
    options[:primary_key] = true
  end
  super
end