Skip to content

Type Operations

Operation: createType

pgm.createType( type_name, values )

IMPORTANT

Create a new data type - postgres docs Alias: addType

Arguments

NameTypeDescription
type_nameNamename of the new type
valuesarray[string] or objectpossible values for an enum type or names and types for a composite type

Reverse Operation: dropType

pgm.dropType( type_name )

IMPORTANT

Drop a custom data type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type to drop

Operation: alterType

pgm.renameType( type_name, new_type_name )

IMPORTANT

Rename a data type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type to rename
new_type_nameNamename of the new type

Operation: alterType

pgm.addTypeAttribute( type_name, attribute_name, attribute_type )

IMPORTANT

Add attribute to an existing data type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type
attribute_namestringname of the attribute to add
attribute_typestringtype of the attribute to add

Reverse Operation: dropTypeAttribute

pgm.dropTypeAttribute( type_name, attribute_name, options )

IMPORTANT

Drop attribute from a data type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type
attribute_namestringname of the attribute to drop
optionsobjectCheck below for available options

Options

OptionTypeDescription
ifExistsbooleandrops attribute only if it exists

Operation: alterType

pgm.setTypeAttribute( type_name, attribute_name, attribute_type )

IMPORTANT

Set data type of an existing data attribute type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type
attribute_namestringname of the attribute to set
attribute_typestringnew type of the attribute

Operation: alterType

pgm.addTypeValue( type_name, value, options )

IMPORTANT

Add value to a list of enum data type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type
valuestringvalue to add to list
optionsobjectCheck below for available options

Options

OptionTypeDescription
ifNotExistsbooleandefault false
beforestringvalue before which the new value should be add
afterstringvalue after which the new value should be add

Reverse Operation: dropTypeValue

pgm.renameTypeAttribute( type_name, attribute_name, new_attribute_name )

IMPORTANT

Rename an attribute of data type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type
attribute_namestringname of the attribute to rename
new_attribute_namestringnew name of the attribute

Operation: alterType

pgm.renameTypeValue( type_name, value, new_value )

IMPORTANT

Rename a value of enum data type - postgres docs

Arguments

NameTypeDescription
type_nameNamename of the type
valuestringvalue to rename
new_valuestringnew value