Module: Torque::PostgreSQL::Adapter::ColumnMethods

Included in:
TableDefinition
Defined in:
lib/torque/postgresql/adapter/schema_definitions.rb

Instance Method Summary collapse

Instance Method Details

#enum(*args, **options) ⇒ Object

Creates a column with an enum type, needing to specify the subtype, which is basically the name of the type defined prior creating the column



16
17
18
19
20
21
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 16

def enum(*args, **options)
  args.each do |name|
    type = options.fetch(:subtype, name)
    column(name, type, options)
  end
end

#enum_set(*args, **options) ⇒ Object

Creates a column with an enum array type, needing to specify the subtype, which is basically the name of the type defined prior creating the column



26
27
28
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 26

def enum_set(*args, **options)
  super(*args, **options.merge(array: true))
end

#interval(*args, **options) ⇒ Object

Creates a column with an interval type, allowing span of times and dates to be stored without having to store a seconds-based integer or any sort of other approach



9
10
11
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 9

def interval(*args, **options)
  args.each { |name| column(name, :interval, options) }
end