Method: Sequel::Postgres::CreatePartitionOfTableGenerator#partition_type

Defined in:
lib/sequel/adapters/shared/postgres.rb

#partition_typeObject

Determine the appropriate partition type for this partition by which methods were called on it.

Raises:



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/sequel/adapters/shared/postgres.rb', line 240

def partition_type
  raise Error, "Unable to determine partition type, multiple different partitioning methods called" if [@from || @to, @list, @modulus || @remainder, @default].compact.length > 1

  if @from || @to
    raise Error, "must call both from and to when creating a partition of a table if calling either" unless @from && @to
    :range
  elsif @in
    :list
  elsif @modulus || @remainder
    raise Error, "must call both modulus and remainder when creating a partition of a table if calling either" unless @modulus && @remainder
    :hash
  elsif @default
    :default
  else
    raise Error, "unable to determine partition type, no partitioning methods called"
  end
end