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



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

def enum(*args, **options)
  subtype = options.delete(:subtype)
  args.each { |name| column(name, (subtype || name), **options) }
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



11
12
13
# File 'lib/torque/postgresql/adapter/schema_definitions.rb', line 11

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