Type
Type
Provides SQL custom type (ENUM/composite) management helpers for DBI drivers.
trait TypeBacked by PostgreSQL's pg_catalog, since custom types have no information_schema representation and no equivalent in SQLite.
Methods
listTypes
Lists custom types (ENUM and composite) defined in the active schema.
public listTypes(): array|falseReturns: array|false
Composite types created implicitly for every table's row type are excluded by requiring pg_class.relkind = 'c' (a standalone composite type), which ordinary tables ('r') fail.
typeExists
Checks whether a custom type exists in the active schema.
public typeExists(string $name): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string |
describeType
Describes a custom type, including its enum values or composite fields.
public describeType(string $name): array|falseReturns: array|false
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string |
createType
Creates a custom type in the database.
public createType(string $name, array $info): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$info | array |
dropType
Drops a custom type from the database.
public dropType(string $name, bool $ifExists, bool $cascade): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$ifExists | bool | |
$cascade | bool |
addEnumValue
Adds a new value to an existing ENUM type.
public addEnumValue(string $name, string $value, ?string $before, ?string $after): boolReturns: bool
Note: PostgreSQL cannot run ALTER TYPE ... ADD VALUE inside a transaction block on versions before 12; callers running snapshots inside a transaction on older servers will need to apply enum additions separately.
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$value | string | |
$before | string | |
$after | string |
addTypeAttribute
Adds a new attribute (field) to an existing composite type.
public addTypeAttribute(string $name, string $fieldName, string $fieldType): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$fieldName | string | |
$fieldType | string |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000