Class: ActiveRecord::ConnectionAdapters::OracleEnhanced::TableDefinition

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

Instance Method Summary collapse

Instance Method Details

#column(name, type, options = {}) ⇒ Object


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb', line 56

def column(name, type, options = {})
  if type == :virtual
    default = {:type => options[:type]}
    if options[:as]
      default[:as] = options[:as]
    elsif options[:default]
      warn "[DEPRECATION] virtual column `:default` option is deprecated.  Please use `:as` instead."
      default[:as] = options[:default]
    else
      raise "No virtual column definition found."
    end
    options[:default] = default
  end
  super(name, type, options)
end

#raw(name, options = {}) ⇒ Object


46
47
48
# File 'lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb', line 46

def raw(name, options={})
  column(name, :raw, options)
end

#virtual(*args) ⇒ Object


50
51
52
53
54
# File 'lib/active_record/connection_adapters/oracle_enhanced/schema_definitions.rb', line 50

def virtual(* args)
  options = args.extract_options!
  column_names = args
  column_names.each { |name| column(name, :virtual, options) }
end